m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to m4/m4/module.c,v


From: Eric Blake
Subject: Changes to m4/m4/module.c,v
Date: Wed, 27 Sep 2006 12:24:55 +0000

CVSROOT:        /sources/m4
Module name:    m4
Changes by:     Eric Blake <ericb>      06/09/27 12:24:53

Index: m4/module.c
===================================================================
RCS file: /sources/m4/m4/m4/module.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- m4/module.c 5 Sep 2006 23:16:40 -0000       1.45
+++ m4/module.c 27 Sep 2006 12:24:53 -0000      1.46
@@ -21,6 +21,7 @@
 #include "pathconf.h"
 #include "ltdl.h"
 #include "m4private.h"
+#include "xvasprintf.h"
 
 /* Define this to see runtime debug info.  Implied by DEBUG.  */
 /*#define DEBUG_MODULES */
@@ -143,7 +144,7 @@
       for (; bp->name != NULL; bp++)
        {
          m4_symbol_value *value = m4_symbol_value_create ();
-         char *           name;
+         const char *     name;
 
          /* Sanity check that builtins meet the required interface.  */
          assert (bp->min_args <= bp->max_args);
@@ -159,20 +160,14 @@
          VALUE_MAX_ARGS (value)        = bp->max_args;
 
          if (m4_get_prefix_builtins_opt (context))
-           {
-             static const char prefix[] = "m4_";
-             size_t len = strlen (prefix) + strlen (bp->name);
-
-             name = (char *) xmalloc (1+ len);
-             snprintf (name, 1+ len, "%s%s", prefix, bp->name);
-           }
+           name = xasprintf ("m4_%s", bp->name);
          else
-           name = (char *) bp->name;
+           name = bp->name;
 
          m4_symbol_pushdef (M4SYMTAB, name, value);
 
          if (m4_get_prefix_builtins_opt (context))
-           free (name);
+           free ((char *) name);
        }
 
       m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
@@ -365,7 +360,7 @@
              module_dlerror ());
 
 #ifdef DEBUG_MODULES
-  fprintf (stderr, "Module loader initialized.\n");
+  fputs ("Module loader initialized.\n", stderr);
 #endif /* DEBUG_MODULES */
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]