Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [PATCH] tui, clean up long lines and xmallocs
       [not found] <15296.12.7.175.2.1185925512.squirrel@webmail.sonic.net>
@ 2007-08-01  8:01 ` Mark Kettenis
  2007-08-01 20:21   ` msnyder
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Kettenis @ 2007-08-01  8:01 UTC (permalink / raw)
  To: msnyder; +Cc: gdb-patches

> Date: Tue, 31 Jul 2007 16:45:12 -0700 (PDT)
> From: msnyder@sonic.net

> 2007-07-31  Michael Snyder  <msnyder@svkmacdonelllnx>
> 
> 	* tui/tui-data.c (tui_alloc_content): Move assign out of if, 
> 	clean up long lines.
> 	(tui_alloc_generic_win_info): Tidy by using XMALLOC macro.
> 	(tui_alloc_win_info): Ditto.
> 	(tui_add_content_elements): Ditto.
> 	* tui/tui-file.c (tui_file_magic): Ditto.

Looks ok to me, but:

> Index: tui-data.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/tui/tui-data.c,v
> retrieving revision 1.15
> diff -p -r1.15 tui-data.c
> *** tui-data.c	28 Jul 2007 01:16:39 -0000	1.15
> --- tui-data.c	31 Jul 2007 23:40:21 -0000
> *************** tui_alloc_win_info (enum tui_win_type ty
> *** 570,577 ****
>   {
>     struct tui_win_info * win_info = (struct tui_win_info *) NULL;
>   
> !   win_info = (struct tui_win_info *) xmalloc (sizeof (struct tui_win_info));
> !   if ((win_info != NULL))
>       {
>         win_info->generic.type = type;
>         init_win_info (win_info);
> --- 569,576 ----
>   {
>     struct tui_win_info * win_info = (struct tui_win_info *) NULL;
>   
> !   win_info = XMALLOC (struct tui_win_info);
> !   if (win_info != NULL)
>       {
>         win_info->generic.type = type;
>         init_win_info (win_info);

While you're there, you might as well remove that redundant
initialization on the line above.

> *************** tui_alloc_content (int num_elements, enu
> *** 589,605 ****
>     char *element_block_ptr = (char *) NULL;
>     int i;
>   
> !   if ((content = (tui_win_content)
> !   xmalloc (sizeof (struct tui_win_element *) * num_elements)) != (tui_win_content) NULL)
> !     {				/*
> ! 				   ** All windows, except the data window, can allocate the elements
> ! 				   ** in a chunk.  The data window cannot because items can be
> ! 				   ** added/removed from the data display by the user at any time.
> ! 				 */
>         if (type != DATA_WIN)
>   	{
> ! 	  if ((element_block_ptr = (char *)
> ! 	   xmalloc (sizeof (struct tui_win_element) * num_elements)) != (char *) NULL)
>   	    {
>   	      for (i = 0; i < num_elements; i++)
>   		{
> --- 588,607 ----
>     char *element_block_ptr = (char *) NULL;
>     int i;
>   
> !   content = xmalloc (sizeof (struct tui_win_element *) * num_elements);

Similar here.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] tui, clean up long lines and xmallocs
  2007-08-01  8:01 ` [PATCH] tui, clean up long lines and xmallocs Mark Kettenis
@ 2007-08-01 20:21   ` msnyder
  0 siblings, 0 replies; 2+ messages in thread
From: msnyder @ 2007-08-01 20:21 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: msnyder, gdb-patches


>
> Looks ok to me, but:
>

>
> While you're there, you might as well remove that redundant
> initialization on the line above.

Done and done, and committed.
Thanks.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-01 20:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <15296.12.7.175.2.1185925512.squirrel@webmail.sonic.net>
2007-08-01  8:01 ` [PATCH] tui, clean up long lines and xmallocs Mark Kettenis
2007-08-01 20:21   ` msnyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox