mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
Make repeated calls accumulate the results, don't call qsort() on empty
2004-12-09 Matthias Clasen <mclasen@redhat.com> * xdgmimealias.c (_xdg_mime_alias_read_from_file): * xdgmimeparent.c (_xdg_mime_parent_read_from_file): Make repeated calls accumulate the results, don't call qsort() on empty arrays. (#160838, Mariano Suárez-Alvarez)
This commit is contained in:
parent
fa136147ff
commit
94ab8fe8c0
@ -1,3 +1,10 @@
|
|||||||
|
2004-12-09 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* xdgmimealias.c (_xdg_mime_alias_read_from_file):
|
||||||
|
* xdgmimeparent.c (_xdg_mime_parent_read_from_file): Make
|
||||||
|
repeated calls accumulate the results, don't call qsort()
|
||||||
|
on empty arrays. (#160838, Mariano Suárez-Alvarez)
|
||||||
|
|
||||||
2004-12-02 Matthias Clasen <mclasen@redhat.com>
|
2004-12-02 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* === Released 2.5.6 ===
|
* === Released 2.5.6 ===
|
||||||
|
@ -128,8 +128,8 @@ _xdg_mime_alias_read_from_file (XdgAliasList *list,
|
|||||||
|
|
||||||
/* FIXME: Not UTF-8 safe. Doesn't work if lines are greater than 255 chars.
|
/* FIXME: Not UTF-8 safe. Doesn't work if lines are greater than 255 chars.
|
||||||
* Blah */
|
* Blah */
|
||||||
alloc = 16;
|
alloc = list->n_aliases + 16;
|
||||||
list->aliases = malloc (alloc * sizeof (XdgAlias));
|
list->aliases = realloc (list->aliases, alloc * sizeof (XdgAlias));
|
||||||
while (fgets (line, 255, file) != NULL)
|
while (fgets (line, 255, file) != NULL)
|
||||||
{
|
{
|
||||||
char *sep;
|
char *sep;
|
||||||
@ -156,8 +156,9 @@ _xdg_mime_alias_read_from_file (XdgAliasList *list,
|
|||||||
|
|
||||||
fclose (file);
|
fclose (file);
|
||||||
|
|
||||||
qsort (list->aliases, list->n_aliases,
|
if (list->n_aliases > 1)
|
||||||
sizeof (XdgAlias), alias_entry_cmp);
|
qsort (list->aliases, list->n_aliases,
|
||||||
|
sizeof (XdgAlias), alias_entry_cmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,8 +134,8 @@ _xdg_mime_parent_read_from_file (XdgParentList *list,
|
|||||||
|
|
||||||
/* FIXME: Not UTF-8 safe. Doesn't work if lines are greater than 255 chars.
|
/* FIXME: Not UTF-8 safe. Doesn't work if lines are greater than 255 chars.
|
||||||
* Blah */
|
* Blah */
|
||||||
alloc = 16;
|
alloc = list->n_mimes + 16;
|
||||||
list->parents = malloc (alloc * sizeof (XdgMimeParents));
|
list->parents = realloc (list->parents, alloc * sizeof (XdgMimeParents));
|
||||||
while (fgets (line, 255, file) != NULL)
|
while (fgets (line, 255, file) != NULL)
|
||||||
{
|
{
|
||||||
char *sep;
|
char *sep;
|
||||||
@ -191,8 +191,9 @@ _xdg_mime_parent_read_from_file (XdgParentList *list,
|
|||||||
|
|
||||||
fclose (file);
|
fclose (file);
|
||||||
|
|
||||||
qsort (list->parents, list->n_mimes,
|
if (list->n_mimes > 1)
|
||||||
sizeof (XdgMimeParents), &parent_entry_cmp);
|
qsort (list->parents, list->n_mimes,
|
||||||
|
sizeof (XdgMimeParents), &parent_entry_cmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user