summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/misc.c b/misc.c
index 75afc20..7c02291 100644
--- a/misc.c
+++ b/misc.c
@@ -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 {