m4-patches
[Top][All Lists]
Advanced

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

compile warnings


From: Eric Blake
Subject: compile warnings
Date: Mon, 9 Oct 2006 20:59:12 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Fixes a -Wshadow warning.

2006-10-09  Eric Blake  <address@hidden>

        * modules/gnu.c (gnu_buf): Rename from buf to silence -Wshadow.

Index: modules/gnu.c
===================================================================
RCS file: /sources/m4/m4/modules/gnu.c,v
retrieving revision 1.62
diff -u -r1.62 gnu.c
--- modules/gnu.c       6 Oct 2006 15:24:10 -0000       1.62
+++ modules/gnu.c       9 Oct 2006 20:50:20 -0000
@@ -110,7 +110,7 @@
   struct re_registers regs;    /* match registers */
 } m4_pattern_buffer;
 
-static m4_pattern_buffer buf;  /* compiled regular expression */
+static m4_pattern_buffer gnu_buf;      /* compiled regular expression */
 
 /* Compile a REGEXP using the RESYNTAX bits, and return the buffer.
    Report errors on behalf of CALLER.  If NO_SUB, optimize the
@@ -120,7 +120,7 @@
 m4_regexp_compile (m4 *context, const char *caller,
                   const char *regexp, int resyntax, bool no_sub)
 {
-  /* buf is guaranteed to start life 0-initialized, which works in the
+  /* gnu_buf is guaranteed to start life 0-initialized, which works in the
      below algorithm.
 
      FIXME - this method is not reentrant, since re_compile_pattern
@@ -128,14 +128,14 @@
      for its syntax (but at least the compiled regex remembers its
      syntax even if the global variable changes later), and since we
      use a static variable.  To be reentrant, we would need a mutex in
-     this method, and move the storage for buf into context.  */
+     this method, and move the storage for gnu_buf into context.  */
 
   const char *msg;             /* error message from re_compile_pattern */
 
   re_set_syntax (resyntax);
-  regfree (&buf.pat);
-  buf.pat.no_sub = no_sub;
-  msg = re_compile_pattern (regexp, strlen (regexp), &buf.pat);
+  regfree (&gnu_buf.pat);
+  gnu_buf.pat.no_sub = no_sub;
+  msg = re_compile_pattern (regexp, strlen (regexp), &gnu_buf.pat);
 
   if (msg != NULL)
     {
@@ -144,9 +144,9 @@
       return NULL;
     }
 
-  re_set_registers (&buf.pat, &buf.regs, buf.regs.num_regs, buf.regs.start,
-                   buf.regs.end);
-  return &buf;
+  re_set_registers (&gnu_buf.pat, &gnu_buf.regs, gnu_buf.regs.num_regs,
+                    gnu_buf.regs.start, gnu_buf.regs.end);
+  return &gnu_buf;
 }
 
 
@@ -156,7 +156,7 @@
 m4_regexp_search (m4_pattern_buffer *buf, const char *string,
                  const int size, const int start, const int range)
 {
-  return re_search (&(buf->pat), string, size, start, range, &(buf->regs));
+  return re_search (&buf->pat, string, size, start, range, &buf->regs);
 }
 
 
@@ -283,12 +283,12 @@
 /* Reclaim memory used by this module.  */
 M4FINISH_HANDLER(gnu)
 {
-  regfree (&buf.pat);
-  free (buf.regs.start);
-  free (buf.regs.end);
+  regfree (&gnu_buf.pat);
+  free (gnu_buf.regs.start);
+  free (gnu_buf.regs.end);
   /* If this module was preloaded, then we need to explicitly reset
      the memory in case it gets reloaded.  */
-  memset (&buf, 0, sizeof buf);
+  memset (&gnu_buf, 0, sizeof gnu_buf);
 }
 
 






reply via email to

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