This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/ARI fix] Remove use of abort function in common/buffer.c


  ARI clearly states that abort function
should never be used, and to use internal_error
instead.

  I first suspected that this was related to missing declarations in 
common directory, but internal_error does
exist there also.

  Finally, looking at common/buffer.c source, I found that
gdb_assert was probably a better fit here
(the macro does call internal_error).


  Is this patch OK or what else should we use here?


Pierre Muller
GDB pascal language maintainer


2012-05-22  Pierre Muller  <muller@ics.u-strasbg.fr>

        * common/buffer.c (buffer_grow): ARI fix: Replace abort
        function call by gdb_assert macro use.

Index: common/buffer.c
===================================================================
RCS file: /cvs/src/src/gdb/common/buffer.c,v
retrieving revision 1.3
diff -u -p -r1.3 buffer.c
--- common/buffer.c     11 May 2012 22:24:22 -0000      1.3
+++ common/buffer.c     22 May 2012 09:10:27 -0000
@@ -23,6 +23,7 @@
 #include "defs.h"
 #endif

+#include "gdb_assert.h"
 #include "xml-utils.h"
 #include "buffer.h"

@@ -47,8 +48,7 @@ buffer_grow (struct buffer *buffer, cons
   while (buffer->used_size + size > new_buffer_size)
     new_buffer_size *= 2;
   new_buffer = xrealloc (buffer->buffer, new_buffer_size);
-  if (!new_buffer)
-    abort ();
+  gdb_assert (new_buffer);
   memcpy (new_buffer + buffer->used_size, data, size);
   buffer->buffer = new_buffer;
   buffer->buffer_size = new_buffer_size;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]