From: Niki Roo Date: Sat, 8 Apr 2023 12:07:36 +0000 (+0200) Subject: utils: desktop: report fix X-Git-Url: http://git.nikiroo.be/?a=commitdiff_plain;h=d30a68f0803272e3a25a5eb1d85d7461a58dbfa2;p=nsub.git utils: desktop: report fix --- diff --git a/src/utils/desktop.c b/src/utils/desktop.c index d200555..7ba34c6 100644 --- a/src/utils/desktop.c +++ b/src/utils/desktop.c @@ -95,7 +95,7 @@ int init_desktop(desktop_t *me, const char filename[], int best_size) { me->icon_file = desktop_find_icon("folder", best_size); } - me->children = new_array(sizeof(desktop_t*), 32); + me->children = new_array(sizeof(desktop_t), 32); for (struct dirent *ep = readdir(dp); ep; ep = readdir(dp)) { if (!strcmp(ep->d_name, ".")) continue; @@ -118,7 +118,7 @@ int init_desktop(desktop_t *me, const char filename[], int best_size) { // Only process ".desktop" files if (!ext || strcmp(ext, EXT)) { - free_desktop(me); + uninit_desktop(me); free(ext); return 0; } @@ -207,9 +207,10 @@ desktop_t *desktop_find_id(array_t *children, int id) { break; } - found = desktop_find_id(child->children, id); - if (found) + if (child->children) { + found = desktop_find_id(child->children, id); break; + } } return found; @@ -218,8 +219,8 @@ desktop_t *desktop_find_id(array_t *children, int id) { /* Private functions */ static int desktop_compare(const void *a, const void* b) { - desktop_t *me1 = ((desktop_t**) a)[0]; - desktop_t *me2 = ((desktop_t**) b)[0]; + desktop_t *me1 = (desktop_t *)a; + desktop_t *me2 = (desktop_t *)b; if (me1->children && !(me2->children)) return -1;