diff options
-rw-r--r-- | misc.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -133,10 +133,8 @@ char *dir_path_num(const char *root, int num) { char *dir_path_name(const char *root, char *name) { if (!is_empty(root)) { if (!is_empty(name)) { - /* Get the length of the path. */ - int len = snprintf(NULL, 0, "%s/%s", root, name); /* Create the directory path. */ - char *dir = calloc(len+1, sizeof(char)); + char *dir = calloc(format_len("%s/%s", root, name)+1, sizeof(char)); sprintf(dir, "%s/%s", root, name); return dir; } else { |