This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: patch: libiberty adjustments for _WIN64


On Mon, Jul 16, 2007 at 11:14:41AM +0200, Kai Tietz wrote:
> "xrealloc" would be possible for reallocating the memory block, but I want 
> to ensure that the the new memory block elements are set to -1.

That would be:

       pid_map = (HANDLE *) xrealloc (pid_map, sizeof (HANDLE) * (pid_map_max + 8));
       memset (&pid_map[pid_map_max], -1, sizeof (HANDLE) * 8);
       pid_map_max += 8;
       pid_map[ret] = ps->hProcess;
       return ret;

xrealloc guarantees returning non-NULL or exit, so you don't have to worry
about allocation failures.

	Jakub


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