From 09282eefd060f910ca2e70dc7c84788a106c215e Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Thu, 17 Sep 2020 13:07:43 +0200 Subject: [PATCH] Remove level parameter from mkdir_r API It has been removed since it is of no use to the end user. --- mkdir_r.c | 9 +++++++-- mkdir_r.h | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mkdir_r.c b/mkdir_r.c index d71c47c..178a250 100644 --- a/mkdir_r.c +++ b/mkdir_r.c @@ -23,7 +23,7 @@ #include #include -int mkdir_r(const char *const path, int level) +static int mkdir_r_lvl(const char *const path, int level) { int ret = -1; char *dir = NULL; @@ -65,7 +65,7 @@ int mkdir_r(const char *const path, int level) } if (*c) - mkdir_r(path, cur_level); + mkdir_r_lvl(path, cur_level); /* No more levels left. */ ret = 0; @@ -79,3 +79,8 @@ exit: return ret; } + +int mkdir_r(const char *const path) +{ + return mkdir_r_lvl(path, 0); +} diff --git a/mkdir_r.h b/mkdir_r.h index cc32b24..5e36f73 100644 --- a/mkdir_r.h +++ b/mkdir_r.h @@ -19,9 +19,8 @@ /** * Recursive directory creation. * @param path Directory path - * @param level Always set to 0. * @return 0 if successful, -1 otherwise. */ -int mkdir_r(const char *const path, int level); +int mkdir_r(const char *const path); #endif /* MKDIR_R_H */