16 FILE * fp = fopen(filename,
"r");
19 fseek(fp, 0, SEEK_END);
20 size_t file_length = ftell(fp);
22 char * buf =
ta_malloc2(filename,
char, file_length + 1);
23 fseek(fp, 0, SEEK_SET);
24 file_length = fread(buf, 1, file_length, fp);
33 size_t N = strlen(str);
34 char * d =
ta_malloc(
"strdup",
char, N + 1);
57 size_t N = vsnprintf(buf0, 1, fmt, va);
59 char * buf =
ta_malloc(
"strdup_vprintf",
char, N + 100);
60 vsnprintf(buf, N + 1, fmt, va2);
73 char * dup =
ta_malloc(
"dirname",
char, strlen(path) + 1);
75 dup[strlen(path)]=
'\0';
77 for(p = i + dup; p >= dup && *p !=
'/'; p --) {
92 char * tmp=
ta_malloc(
"dirname",
char, strlen(dir) + 1);
94 tmp[strlen(dir)]=
'\0';
99 if(tmp[len - 1] ==
'/')
101 for(p = tmp + 1; *p; p++)
104 mkdir(tmp, S_IRWXU | S_IRWXG | S_IRWXO);
107 mkdir(tmp, S_IRWXU | S_IRWXG | S_IRWXO);
#define ta_malloc2(name, type, nele)
#define ta_malloc(name, type, nele)
static void _mkdir(const char *dir)
void fastpm_path_ensure_dirname(const char *path)
char * fastpm_file_get_content(const char *filename)
char * fastpm_strdup_printf(const char *fmt,...)
char * fastpm_strdup(const char *str)
char * fastpm_strdup_vprintf(const char *fmt, va_list va)