[xiph-commits] r13390 - experimental/moritz/xalloc

moritz at svn.xiph.org moritz at svn.xiph.org
Sat Jul 28 17:22:55 PDT 2007


Author: moritz
Date: 2007-07-28 17:22:54 -0700 (Sat, 28 Jul 2007)
New Revision: 13390

Modified:
   experimental/moritz/xalloc/main.c
   experimental/moritz/xalloc/xalloc.h
Log:
Misc tweaks, and be strictly C99 in the macros.


Modified: experimental/moritz/xalloc/main.c
===================================================================
--- experimental/moritz/xalloc/main.c	2007-07-29 00:07:20 UTC (rev 13389)
+++ experimental/moritz/xalloc/main.c	2007-07-29 00:22:54 UTC (rev 13390)
@@ -13,7 +13,7 @@
 int
 main(void)
 {
-	char *foo, *bar, *baz;
+	char *foo, *bar, *baz, *bla;
 
 #ifdef XALLOC_DEBUG
 	xalloc_initialize_debug(2, NULL);
@@ -25,6 +25,7 @@
 	bar = xcalloc(12, sizeof(char));
 	baz = xmalloc(80);
 	baz = xrealloc(baz, 100, sizeof(char));
+	xasprintf(&bla, "Blabla? Blah-%d!", 1000);
 	xfree(foo);
 	xfree(baz);
 

Modified: experimental/moritz/xalloc/xalloc.h
===================================================================
--- experimental/moritz/xalloc/xalloc.h	2007-07-29 00:07:20 UTC (rev 13389)
+++ experimental/moritz/xalloc/xalloc.h	2007-07-29 00:22:54 UTC (rev 13390)
@@ -39,13 +39,13 @@
  * defined.
  *
  * Define XALLOC_WITH_XASPRINTF to expose the xasprintf() interface. Doing
- * so will require libxalloc to be compiled with a C99 compiler, and work
- * only on systems with (v)asprintf() or a modern (v)snprintf(). MS Windows
- * is supported.
+ * so will require libxalloc to be compiled with a compiler that supports C99
+ * variadic macros, and work only on systems with vasprintf() or vsnprintf(),
+ * and MS Windows.
  */
-/* #define XALLOC_DEBUG 1 */
+#define XALLOC_DEBUG 1
 /* #define XALLOC_SILENT 1 */
-/* #define XALLOC_WITH_XASPRINTF 1 */
+#define XALLOC_WITH_XASPRINTF 1
 
 /* The default output stream for messages: */
 #define XALLOC_DEFAULT_OUTPUT	stderr
@@ -115,8 +115,8 @@
 #endif /* XALLOC_DEBUG */
 
 #ifdef XALLOC_WITH_XASPRINTF
-# define xasprintf(s, f, va...) 					\
-        xasprintf_c(__FILE__, __LINE__, s, f , ##va)
+# define xasprintf(s, f, ...)						\
+	xasprintf_c(__FILE__, __LINE__, s, f, __VA_ARGS__)
 int	xasprintf_c(const char * /* file */, unsigned int /* line */,
 		    char ** /* string pointer */, const char * /* format */,
 		    ...);



More information about the commits mailing list