sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 11eef783fe81a36a8887683f56436697152c6372
parent fb1bfe24bb4ae08bdd56732244a74d89033dd130
Author: sin <sin@2f30.org>
Date:   Mon, 12 May 2014 00:39:56 +0100

Declare error buffer at start of block

Diffstat:
Mgrep.c | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/grep.c b/grep.c @@ -112,6 +112,7 @@ addpattern(const char *pattern) bool grep(FILE *fp, const char *str, int flags) { + char err[BUFSIZ]; char *buf = NULL; long n, c = 0; int r; @@ -123,8 +124,6 @@ grep(FILE *fp, const char *str, int flags) for(n = 1; afgets(&buf, &size, fp); n++) { for(pnode = phead; pnode; pnode = pnode->next) { if((r = regcomp(&preg, pnode->pattern, flags)) != 0) { - char err[BUFSIZ]; - regerror(r, &preg, err, sizeof err); enprintf(Error, "invalid pattern: %s\n", err); }