From: Bastian Dehn Date: Tue, 3 Mar 2026 20:23:12 +0000 (+0100) Subject: change replace point with replace X-Git-Tag: 1.1.6^2~1^2~1 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=f50e99e38d055db1caae6c69ffc0efe721507ff1;p=mv_none_space.git change replace point with replace --- diff --git a/src/rename.c b/src/rename.c index eeb169c..4a00501 100644 --- a/src/rename.c +++ b/src/rename.c @@ -63,18 +63,19 @@ void escape(const char* src, char* dst) void rename_point(const char* src, char* dst) { - rename_string(src, dst); + size_t len = strlen(src) + 1; + char* out = malloc(len); + if (out == NULL) + return; - size_t length = strlen(dst); - int point_count = 0; - for (size_t i = length - 1; i > 0; i--) { - if (dst[i] == '.') - point_count++; - else - break; - } + memcpy(out, src, len); + + rename_string(src, out); + out = replace(&out, ".", ""); - dst[length - point_count] = '\0'; + memcpy(dst, out, strlen(out) + 1); + free(out); + out = NULL; } void rename_lower(const char* src, char* dst)