Skip to content
Myr

dmenu: don't try to allocate a zero-length array

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Daniel Eklöf · committed by Daniel Eklöf · parent 5396fa1 · Browse files · 1 file+12 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−9 removed

  • other:+12 added−9 removed

1 file+12 added−9 removed

modified:dmenu.c+12 added-9 removed
177 unmodified lines
178 if (event_fd >= 0) {179 mtx_lock(&applications->lock);180181 const size_t new_count = applications->count + tll_length(entries);182 if (new_count > 0) {182 applications->v = xreallocarray(183 applications->v, new_count, sizeof(applications->v[0]));183 applications->v = xreallocarray(184 applications->v, new_count, sizeof(applications->v[0]));185185 size_t i = applications->count;186 tll_foreach(entries, it) {187 applications->v[i++] = it->item;188 tll_remove(entries, it);186 size_t i = applications->count;187 tll_foreach(entries, it) {188 applications->v[i++] = it->item;189 tll_remove(entries, it);190 }191192 assert(i == new_count);193 applications->count = applications->visible_count = new_count;194 send_event(event_fd, EVENT_APPS_SOME_LOADED);195 }196191 assert(i == new_count);192 applications->count = applications->visible_count = new_count;193 send_event(event_fd, EVENT_APPS_SOME_LOADED);197 mtx_unlock(&applications->lock);198 }199 }200
45 unmodified lines