]> gitweb.hhaalo.de Git - mv_none_space.git/commitdiff
change replace point with replace
authorBastian Dehn <hhaalo@arcor.de>
Tue, 3 Mar 2026 20:23:12 +0000 (21:23 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 3 Mar 2026 20:23:12 +0000 (21:23 +0100)
src/rename.c

index eeb169ca0885bbdad52ada3be861273c964cd5cc..4a00501e8bc9d9dac37cc29019203a3e3a397b34 100644 (file)
@@ -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)