diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2022-08-05 13:51:09 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2022-08-05 13:51:09 -0300 |
commit | ada68736474b42bffe5d8b4b2b2a4d67c738f95c (patch) | |
tree | 4a283aca83d8a57842ab5a022d8d5da42e2f6396 | |
parent | 2de000040299e0f8d7d013acdb8cc0e958ece0e7 (diff) |
git: Make use of `format_len()` in `dir_path_name()`
-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 { |