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-v3/ARI fix] Remove use of abort function in common/buffer.c


> Fine with me, but I'd suggest to just say nothing.  The whole point of the
> xrealloc,
> xmalloc, etc. functions is to abort on failure instead of returning NULL.
> We have
> about 150 or so xrealloc calls in the tree, about 70 xcalloc calls, and
> about 700 xmalloc calls.  We don't put just comment on most (any?) of
those,
> and
> I don't see what makes this particular instance special.

  You are right,
OK for that even simpler patch?


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

        * common/buffer.c (buffer_grow): ARI fix: Remove unneeded
        call to abort.

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 15:13:24 -0000
@@ -47,8 +47,6 @@ 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 ();
   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]