summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-08-05 13:51:09 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-08-05 13:51:09 -0300
commitada68736474b42bffe5d8b4b2b2a4d67c738f95c (patch)
tree4a283aca83d8a57842ab5a022d8d5da42e2f6396
parent2de000040299e0f8d7d013acdb8cc0e958ece0e7 (diff)
git: Make use of `format_len()` in `dir_path_name()`
-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 {