From f2614efe03e04575e1b9ded663a553557452c7ae Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Wed, 24 May 2023 23:28:09 +0200 Subject: Formatting changes --- src/dged/path.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/dged/path.h') diff --git a/src/dged/path.h b/src/dged/path.h index d74f723..6e11d6a 100644 --- a/src/dged/path.h +++ b/src/dged/path.h @@ -9,19 +9,19 @@ static char *expanduser(const char *path) { if (tilde_pos != NULL) { char *home = getenv("HOME"); if (home != NULL) { - // allocate a new string based with the new len - size_t home_len = strlen(home); - size_t path_len = strlen(path); - size_t total_len = path_len + home_len; - res = malloc(total_len); - size_t initial_len = tilde_pos - path; - strncpy(res, path, initial_len); + // allocate a new string based with the new len + size_t home_len = strlen(home); + size_t path_len = strlen(path); + size_t total_len = path_len + home_len; + res = malloc(total_len); + size_t initial_len = tilde_pos - path; + strncpy(res, path, initial_len); - strncpy(res + initial_len, home, home_len); + strncpy(res + initial_len, home, home_len); - size_t rest_len = path_len - initial_len - 1; - strncpy(res + initial_len + home_len, path + initial_len + 1, rest_len); - res[total_len-1] = '\0'; + size_t rest_len = path_len - initial_len - 1; + strncpy(res + initial_len + home_len, path + initial_len + 1, rest_len); + res[total_len - 1] = '\0'; } } -- cgit v1.2.3