This is the mail archive of the gdb-patches@sources.redhat.com 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]

[commit] Document remaining PTRs


Hello,

Following up michael c's comments. This zaps the .y PTR uses and adds a comment to the others.

We're now really `PTR free'.

committed,
Andrew
2003-01-31  Andrew Cagney  <ac131313@redhat.com>

	* objc-exp.y, c-exp.y, f-exp.y: Remove PTR casts.
	* utils.c: Update comments documenting legitimate uses of PTR.
	
Index: c-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/c-exp.y,v
retrieving revision 1.17
diff -u -r1.17 c-exp.y
--- c-exp.y	6 Nov 2002 22:48:25 -0000	1.17
+++ c-exp.y	31 Jan 2003 23:20:53 -0000
@@ -781,7 +781,7 @@
 func_mod:	'(' ')'
 			{ $$ = 0; }
 	|	'(' nonempty_typelist ')'
-			{ free ((PTR)$2); $$ = 0; }
+			{ free ($2); $$ = 0; }
 	;
 
 /* We used to try to recognize more pointer to member types here, but
Index: f-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/f-exp.y,v
retrieving revision 1.9
diff -u -r1.9 f-exp.y
--- f-exp.y	6 Nov 2002 22:48:25 -0000	1.9
+++ f-exp.y	31 Jan 2003 23:20:53 -0000
@@ -564,7 +564,7 @@
 func_mod:	'(' ')'
 			{ $$ = 0; }
 	|	'(' nonempty_typelist ')'
-			{ free ((PTR)$2); $$ = 0; }
+			{ free ($2); $$ = 0; }
 	;
 
 typebase  /* Implements (approximately): (type-qualifier)* type-specifier */
Index: objc-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/objc-exp.y,v
retrieving revision 1.8
diff -u -r1.8 objc-exp.y
--- objc-exp.y	31 Dec 2002 04:48:32 -0000	1.8
+++ objc-exp.y	31 Jan 2003 23:20:54 -0000
@@ -842,7 +842,7 @@
 func_mod:	'(' ')'
 			{ $$ = 0; }
 	|	'(' nonempty_typelist ')'
-			{ free ((PTR)$2); $$ = 0; }
+			{ free ($2); $$ = 0; }
 	;
 
 /* We used to try to recognize more pointer to member types here, but
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.91
diff -u -r1.91 utils.c
--- utils.c	31 Jan 2003 22:45:22 -0000	1.91
+++ utils.c	31 Jan 2003 23:20:57 -0000
@@ -66,10 +66,10 @@
 #endif
 
 #ifdef NEED_DECLARATION_MALLOC
-extern PTR malloc ();
+extern PTR malloc ();		/* OK: PTR */
 #endif
 #ifdef NEED_DECLARATION_REALLOC
-extern PTR realloc ();
+extern PTR realloc ();		/* OK: PTR */
 #endif
 #ifdef NEED_DECLARATION_FREE
 extern void free ();
@@ -955,9 +955,6 @@
 
 #if !defined (USE_MMALLOC)
 
-/* NOTE: These must use PTR so that their definition matches the
-   declaration found in "mmalloc.h". */
-
 static void *
 mmalloc (void *md, size_t size)
 {
@@ -1150,19 +1147,19 @@
 /* NOTE: These are declared using PTR to ensure consistency with
    "libiberty.h".  xfree() is GDB local.  */
 
-PTR
+PTR				/* OK: PTR */
 xmalloc (size_t size)
 {
   return xmmalloc (NULL, size);
 }
 
-PTR
-xrealloc (PTR ptr, size_t size)
+PTR				/* OK: PTR */
+xrealloc (PTR ptr, size_t size)	/* OK: PTR */
 {
   return xmrealloc (NULL, ptr, size);
 }
 
-PTR
+PTR				/* OK: PTR */
 xcalloc (size_t number, size_t size)
 {
   return xmcalloc (NULL, number, size);

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