Kaydet (Commit) 7ff6f6b7 authored tarafından Colomban Wendling's avatar Colomban Wendling

Cleanup utils_remove_ext_from_filename()

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5993 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 386b3212
......@@ -596,7 +596,7 @@ gchar *utils_remove_ext_from_filename(const gchar *filename)
{
gchar *last_dot;
gchar *result;
gint i;
gsize len;
g_return_val_if_fail(filename != NULL, NULL);
......@@ -604,15 +604,11 @@ gchar *utils_remove_ext_from_filename(const gchar *filename)
if (! last_dot)
return g_strdup(filename);
/* assumes extension is small, so extra bytes don't matter */
result = g_malloc(strlen(filename));
i = 0;
while ((filename + i) != last_dot)
{
result[i] = filename[i];
i++;
}
result[i] = 0;
len = (gsize) (last_dot - filename);
result = g_malloc(len + 1);
memcpy(result, filename, len);
result[len] = 0;
return result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment