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)