From owner-freebsd-current@FreeBSD.ORG Mon Jul 14 18:33:42 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8543337B401 for ; Mon, 14 Jul 2003 18:33:42 -0700 (PDT) Received: from white.imgsrc.co.jp (ns.imgsrc.co.jp [210.226.20.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3A75943FAF for ; Mon, 14 Jul 2003 18:33:41 -0700 (PDT) (envelope-from kuriyama@imgsrc.co.jp) Received: from localhost (localhost [127.0.0.1]) by white.imgsrc.co.jp (Postfix) with ESMTP id 1214F410A for ; Tue, 15 Jul 2003 10:33:40 +0900 (JST) Received: from black.imgsrc.co.jp (black.imgsrc.co.jp [2001:218:422:2::130]) by white.imgsrc.co.jp (Postfix) with ESMTP id 4B2CB42E3 for ; Tue, 15 Jul 2003 10:33:39 +0900 (JST) Received: from black.imgsrc.co.jp (black.imgsrc.co.jp [2001:218:422:2::130]) by black.imgsrc.co.jp (Postfix) with ESMTP id 226451E4626 for ; Tue, 15 Jul 2003 10:33:39 +0900 (JST) Date: Tue, 15 Jul 2003 10:33:38 +0900 Message-ID: <7madbg60b1.wl@black.imgsrc.co.jp> From: Jun Kuriyama To: Current User-Agent: Wanderlust/2.10.0 (Venus) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.4 Emacs/21.2 (i386--freebsd) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS snapshot-20020531 Subject: src/bin/ed/re.c: warning: declaration of `exp' shadows a global declaration X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2003 01:33:42 -0000 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 :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 // IMG SRC, Inc. // FreeBSD Project