emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 98d0fc989a0 04/11: Pacify GCC 14 -Walloc-size


From: Paul Eggert
Subject: master 98d0fc989a0 04/11: Pacify GCC 14 -Walloc-size
Date: Tue, 30 Apr 2024 04:26:37 -0400 (EDT)

branch: master
commit 98d0fc989a00dda19412ec5cd3ebe9fb4f276521
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Pacify GCC 14 -Walloc-size
    
    * src/xfns.c (xic_string_conversion_callback): Allocate size 1, not 0.
---
 src/xfns.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/xfns.c b/src/xfns.c
index d610c839bfc..67db461a379 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3917,11 +3917,12 @@ xic_string_conversion_callback (XIC ic, XPointer 
client_data,
   return;
 
  failure:
-  /* Return a string of length 0 using the C library malloc.  This
+  /* Return a string of length 0 using the C library malloc (1)
+     (not malloc (0), to pacify gcc -Walloc-size).  This
      assumes XFree is able to free data allocated with our malloc
      wrapper.  */
   call_data->text->length = 0;
-  call_data->text->string.mbs = malloc (0);
+  call_data->text->string.mbs = malloc (1);
 }
 
 #endif /* HAVE_X_I18N */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]