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]

Re: Flash support part 1: memory maps


> From: Vladimir Prus <vladimir@codesourcery.com>
> Date: Fri, 21 Jul 2006 15:35:29 +0400
> Cc: gdb-patches@sources.redhat.com
> 
> > > +  if (!data->character_data)
> > > +    data->character_data = (char *)malloc (len + 1);
> > > +  else
> > > +    {
> > > +      current_size = strlen (data->character_data);
> > > +      data->character_data = (char *)realloc (data->character_data,
> > > +                                              current_size + len + 1);
> >
> > Why do we need to cast the results of malloc and realloc?
> 
> Ah, yea, we don't need this in C.

In fact, I think you should replace these with xmalloc and xrealloc.


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