bad/utils: Simplify get_file_extension

By using g_strrstr

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6715>
This commit is contained in:
Edward Hervey 2024-04-23 11:00:21 +02:00 committed by GStreamer Marge Bot
parent 131679b9d0
commit b3c9f598aa

View file

@ -85,22 +85,12 @@ ensure_uri (const gchar * location)
gchar *
get_file_extension (gchar * uri)
{
size_t len;
gint find;
gchar *dot = g_strrstr (uri, ".");
len = strlen (uri);
find = len - 1;
while (find >= 0) {
if (uri[find] == '.')
break;
find--;
}
if (find < 0)
if (!dot)
return NULL;
return &uri[find + 1];
return dot + 1;
}
GList *