With new gcc and -Wshadow, src/bin/ed/re.c shows this warning: cc -Wshadow -c re.c re.c: In function `get_compiled_pattern': re.c:44: warning: declaration of `exp' shadows a global declaration <built-in>:0: warning: shadowed declaration is here
It seems local variable exp is conflicted with exp(3) declaration. I don't know what name should be used... Index: re.c =================================================================== RCS file: /home/ncvs/src/bin/ed/re.c,v retrieving revision 1.19 diff -u -r1.19 re.c --- re.c 30 Jun 2002 05:13:53 -0000 1.19 +++ re.c 14 Jul 2003 23:42:41 -0000 @@ -41,7 +41,7 @@ pattern_t * get_compiled_pattern(void) { - static pattern_t *exp = NULL; + static pattern_t *expr = NULL; static char error[1024]; char *exps; @@ -52,27 +52,27 @@ errmsg = "invalid pattern delimiter"; return NULL; } else if (delimiter == '\n' || *++ibufp == '\n' || *ibufp == delimiter) { - if (!exp) + if (!expr) errmsg = "no previous pattern"; - return exp; + return expr; } else if ((exps = extract_pattern(delimiter)) == NULL) return NULL; /* buffer alloc'd && not reserved */ - if (exp && !patlock) - regfree(exp); - else if ((exp = (pattern_t *) malloc(sizeof(pattern_t))) == NULL) { + if (expr && !patlock) + regfree(expr); + else if ((expr = (pattern_t *) malloc(sizeof(pattern_t))) == NULL) { fprintf(stderr, "%s\n", strerror(errno)); errmsg = "out of memory"; return NULL; } patlock = 0; - if ((n = regcomp(exp, exps, 0))) { - regerror(n, exp, error, sizeof error); + if ((n = regcomp(expr, exps, 0))) { + regerror(n, expr, error, sizeof error); errmsg = error; - free(exp); - return exp = NULL; + free(expr); + return expr = NULL; } - return exp; + return expr; } -- Jun Kuriyama <[EMAIL PROTECTED]> // IMG SRC, Inc. <[EMAIL PROTECTED]> // FreeBSD Project _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "[EMAIL PROTECTED]"