Patch to add ACONCAT macro to libiberty

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Tue Sep 18 11:39:00 GMT 2001


 > From: DJ Delorie <dj@redhat.com>
 > 
 > >  > > + /* Determine the length of concatenating an arbitrary number of
 > >  > > +    strings, up to (char *) NULL.  */
 > >  > > + 
 > >  > > + extern unsigned long concat_length PARAMS ((const char *, ...));
 > >  > 
 > >  > This should say "including" not "up to".
 > > 
 > > I don't think so, I copied that fragment from the comments above the
 > > original concat function.  The NULL in this case refers to the last
 > > argument to concat, not the trailing NULL terminator in any string.
 > > That last NULL argument is not copied, its a marker for the end of the
 > > variable argument list.
 > 
 > Ok, then it's obviously confusing ;-) How about "...strings.  You must
 > pass NULL as the last argument of this function, to terminate the list
 > of strings." ?  Although, if it the current text is the same as the
 > previous text, I won't stop the patch just because of that.
 > [...]
 > I have no other comments.


Should I install this update?


2001-09-18  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* libiberty.h (concat, concat_length, concat_copy, concat_copy2,
	ACONCAT): Improve comments.

--- libiberty.h~	Tue Sep 18 14:31:02 2001
+++ libiberty.h	Tue Sep 18 14:33:37 2001
@@ -85,25 +85,29 @@ extern char *basename ();
 
 extern const char *lbasename PARAMS ((const char *));
 
-/* Concatenate an arbitrary number of strings, up to (char *) NULL.
-   Allocates memory using xmalloc.  */
+/* Concatenate an arbitrary number of strings.  You must pass NULL as
+   the last argument of this function, to terminate the list of
+   strings.  Allocates memory using xmalloc.  */
 
 extern char *concat PARAMS ((const char *, ...)) ATTRIBUTE_MALLOC;
 
 /* Determine the length of concatenating an arbitrary number of
-   strings, up to (char *) NULL.  */
+   strings.  You must pass NULL as the last argument of this function,
+   to terminate the list of strings.  */
 
 extern unsigned long concat_length PARAMS ((const char *, ...));
 
 /* Concatenate an arbitrary number of strings into a SUPPLIED area of
-   memory, up to (char *) NULL.  The supplied memory is assumed to be
-   large enough.  */
+   memory.  You must pass NULL as the last argument of this function,
+   to terminate the list of strings.  The supplied memory is assumed
+   to be large enough.  */
 
 extern char *concat_copy PARAMS ((char *, const char *, ...));
 
 /* Concatenate an arbitrary number of strings into a GLOBAL area of
-   memory, up to (char *) NULL.  The supplied memory is assumed to be
-   large enough.  */
+   memory.  You must pass NULL as the last argument of this function,
+   to terminate the list of strings.  The supplied memory is assumed
+   to be large enough.  */
 
 extern char *concat_copy2 PARAMS ((const char *, ...));
 
@@ -111,8 +115,10 @@ extern char *concat_copy2 PARAMS ((const
 
 extern char *libiberty_concat_ptr;
 
-/* Concatenate an arbitrary number of strings, up to (char *) NULL.
-   Allocates memory using alloca.  Arguments are evaluated twice!.  */
+/* Concatenate an arbitrary number of strings.  You must pass NULL as
+   the last argument of this function, to terminate the list of
+   strings.  Allocates memory using alloca.  The arguments are
+   evaluated twice!  */
 #define ACONCAT(ACONCAT_PARAMS) \
   (libiberty_concat_ptr = alloca (concat_length ACONCAT_PARAMS + 1), \
    concat_copy2 ACONCAT_PARAMS)



More information about the Gcc-patches mailing list