mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-26 03:23:46 +08:00
add __mg_get_extension and __mg_extract_integers
This commit is contained in:
+16
-1
@@ -72,8 +72,9 @@ struct timezone {
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Function definitions */
|
||||
#include <string.h> // for strrchr
|
||||
|
||||
/* Function definitions */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
@@ -114,6 +115,20 @@ BOOL __mg_is_abs_path (const char* path);
|
||||
int __mg_path_joint (char* dst, int dst_size, const char* abs_path,
|
||||
const char* sub_path);
|
||||
|
||||
/* Since 4.2.0 */
|
||||
static inline
|
||||
const char* __mg_get_extension (const char* filename) {
|
||||
const char* ext;
|
||||
ext = strrchr (filename, '.');
|
||||
if (ext)
|
||||
return ext + 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Extract integers in pattern like "100x100" or "100,100", and returns
|
||||
// the number of integers extracted successfully.
|
||||
int __mg_extract_integers (const char* s, int c, int* ab, int max_nr);
|
||||
|
||||
/* Since 4.2.0 */
|
||||
#ifndef __NOUNIX__
|
||||
int __mg_create_anonymous_file (off_t size, const char* debug_name,
|
||||
|
||||
Reference in New Issue
Block a user