[hackers] [sbase] Declare error buffer at start of block || sin
commit 11eef783fe81a36a8887683f56436697152c6372
Author: sin <sin_AT_2f30.org>
Date: Mon May 12 00:39:56 2014 +0100
Declare error buffer at start of block
diff --git a/grep.c b/grep.c
index f6bbcc1..8651619 100644
--- a/grep.c
+++ b/grep.c
_AT_@ -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;
_AT_@ -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
", err);
}
Received on Mon May 12 2014 - 01:40:35 CEST
This archive was generated by hypermail 2.3.0
: Mon May 12 2014 - 01:48:12 CEST