Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] varobj.c (cplus_describe_child): guard null (resubmit)
@ 2007-08-13 22:43 msnyder
  2007-08-14  3:02 ` Vladimir Prus
  2007-08-14 18:28 ` msnyder
  0 siblings, 2 replies; 4+ messages in thread
From: msnyder @ 2007-08-13 22:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: ghost

[-- Attachment #1: Type: text/plain, Size: 101 bytes --]

Adapted from Vladimir's suggestion.  The switch default
allows the pointer to be null at this point.

[-- Attachment #2: 304b.txt --]
[-- Type: text/plain, Size: 1557 bytes --]

2007-08-13  Michael Snyder  <msnyder@access-company.com>

	* varobj.c (cplus_describe_child): Guard against null.
	Use "NULL" instead of "0" to initialize pointers.

Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.90
diff -p -r1.90 varobj.c
*** varobj.c	8 Aug 2007 21:46:37 -0000	1.90
--- varobj.c	13 Aug 2007 22:37:46 -0000
*************** static void
*** 2315,2321 ****
  cplus_describe_child (struct varobj *parent, int index,
  		      char **cname, struct value **cvalue, struct type **ctype)
  {
!   char *name = 0;
    struct value *value;
    struct type *type;
  
--- 2315,2321 ----
  cplus_describe_child (struct varobj *parent, int index,
  		      char **cname, struct value **cvalue, struct type **ctype)
  {
!   char *name = NULL;
    struct value *value;
    struct type *type;
  
*************** cplus_describe_child (struct varobj *par
*** 2396,2402 ****
  	}
        else
  	{
! 	  char *access = 0;
  	  int children[3];
  	  cplus_class_num_children (type, children);
  
--- 2396,2402 ----
  	}
        else
  	{
! 	  char *access = NULL;
  	  int children[3];
  	  cplus_class_num_children (type, children);
  
*************** cplus_describe_child (struct varobj *par
*** 2435,2441 ****
  	      /* error! */
  	      break;
  	    }
! 	  
  	  if (cname)
  	    *cname = xstrdup (access);
  
--- 2435,2442 ----
  	      /* error! */
  	      break;
  	    }
! 
! 	  gdb_assert (access);
  	  if (cname)
  	    *cname = xstrdup (access);
  

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

end of thread, other threads:[~2007-08-14 18:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-13 22:43 [PATCH] varobj.c (cplus_describe_child): guard null (resubmit) msnyder
2007-08-14  3:02 ` Vladimir Prus
2007-08-14  3:10   ` Daniel Jacobowitz
2007-08-14 18:28 ` msnyder

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