Skip to content

XEVI: fix -Walloc-size

Sam James requested to merge thesamesam/libxext:alloc-size into master

GCC 14 introduces a new -Walloc-size included in -Wextra which gives (when forced to be an error):

XEVI.c:174:21: error: allocation of insufficient size '1' for type 'ExtendedVisualInfo' with size '48' [-Werror=alloc-size]
  174 |         *evi_return = Xcalloc(sz_info + sz_conflict, 1);
      |                     ^

The calloc prototype is:

void *calloc(size_t nmemb, size_t size);

(Xcalloc is esenetially the same.)

So, just swap the number of members and size arguments to match the prototype, as we're initialising 1 element of size sz_info + sz_conflict. GCC then sees we're not doing anything wrong.

Signed-off-by: Sam James sam@gentoo.org

Merge request reports

Loading