Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Pedro Alves'" <palves@redhat.com>
Cc: <gdb-patches@sourceware.org>
Subject: [RFA-v2/ARI fix] Remove use of abort function in common/buffer.c
Date: Tue, 22 May 2012 12:05:00 -0000	[thread overview]
Message-ID: <000c01cd3813$32090b40$961b21c0$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <4FBB5D9B.5070202@redhat.com>

> We should just remove the abort; it's dead code.  xrealloc already handles
> that for us.  common/common-utils.c:xrealloc:

 Pedro, you are right of course...
Here is an update that just removes
the call to abort, and added a small
comment to explain.

Is this OK?

Pierre Muller
GDB pascal language maintainer



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 12:02:18 -0000
@@ -47,8 +47,8 @@ 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 ();
+  /* new_buffer is non NULL otherwise
+     xrealloc calls malloc_failure which does not return here.  */
   memcpy (new_buffer + buffer->used_size, data, size);
   buffer->buffer = new_buffer;
   buffer->buffer_size = new_buffer_size;





  reply	other threads:[~2012-05-22 12:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4fbb59b7.44e2440a.48c4.ffffab13SMTPIN_ADDED@mx.google.com>
2012-05-22  9:34 ` [RFA/ARI " Pedro Alves
2012-05-22 12:05   ` Pierre Muller [this message]
2012-05-22 12:18     ` [RFA-v2/ARI " Joel Brobecker
2012-05-22 12:39       ` Pedro Alves
2012-05-22 15:15         ` [RFA-v3/ARI " Pierre Muller
2012-05-22 15:18           ` Pedro Alves
2012-05-22 15:57             ` Pierre Muller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000c01cd3813$32090b40$961b21c0$@muller@ics-cnrs.unistra.fr' \
    --to=pierre.muller@ics-cnrs.unistra.fr \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox