PERFORCE change 163219 for review
Gabor Kovesdan
gabor at FreeBSD.org
Mon Jun 1 01:19:08 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=163219
Change 163219 by gabor at gabor_server on 2009/06/01 01:18:31
- Remove a leftover
- Little changes towards WARNS=6
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/grep/fastgrep.c#13 edit
.. //depot/projects/soc2008/gabor_textproc/grep/grep.h#49 edit
.. //depot/projects/soc2008/gabor_textproc/grep/util.c#82 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/grep/fastgrep.c#13 (text+ko) ====
@@ -53,20 +53,20 @@
static void grep_revstr(unsigned char *, int);
void
-fgrepcomp(fastgrep_t *fg, const char *pattern)
+fgrepcomp(fastgrep_t *fg, const char *pat)
{
int i;
/* Initialize. */
- fg->len = strlen(pattern);
+ fg->len = strlen(pat);
fg->bol = 0;
fg->eol = 0;
fg->reversed = 0;
- fg->pattern = (unsigned char *)pattern; /* really const */
+ fg->pattern = (unsigned char *)pat; /* really const */
/* Preprocess pattern. */
- for (i = 0; i <= UCHAR_MAX; i++)
+ for (i = 0; i <= (signed)UCHAR_MAX; i++)
fg->qsBc[i] = fg->len;
for (i = 1; i < fg->len; i++)
fg->qsBc[fg->pattern[i]] = fg->len - i;
@@ -76,7 +76,7 @@
* Returns: -1 on failure, 0 on success
*/
int
-fastcomp(fastgrep_t *fg, const char *pattern)
+fastcomp(fastgrep_t *fg, const char *pat)
{
int i;
int bol = 0;
@@ -88,28 +88,28 @@
int lastHalfDot = 0;
/* Initialize. */
- fg->len = strlen(pattern);
+ fg->len = strlen(pat);
fg->bol = 0;
fg->eol = 0;
fg->reversed = 0;
/* Remove end-of-line character ('$'). */
- if (pattern[fg->len - 1] == '$') {
+ if (pat[fg->len - 1] == '$') {
eol++;
fg->eol = 1;
fg->len--;
}
/* Remove beginning-of-line character ('^'). */
- if (pattern[0] == '^') {
+ if (pat[0] == '^') {
bol++;
fg->bol = 1;
fg->len--;
}
if (fg->len >= 14 &&
- strncmp(pattern + fg->bol, "[[:<:]]", 7) == 0 &&
- strncmp(pattern + fg->bol + fg->len - 7, "[[:>:]]", 7) == 0) {
+ strncmp(pat + fg->bol, "[[:<:]]", 7) == 0 &&
+ strncmp(pat + fg->bol + fg->len - 7, "[[:>:]]", 7) == 0) {
fg->len -= 14;
/* Word boundary is handled separately in util.c */
wflag = true;
@@ -121,7 +121,7 @@
* string respectively.
*/
fg->pattern = grep_malloc(fg->len + 1);
- memcpy(fg->pattern, pattern + bol + wflag, fg->len);
+ memcpy(fg->pattern, pat + bol + wflag, fg->len);
fg->pattern[fg->len] = '\0';
/* Look for ways to cheat...er...avoid the full regex engine. */
@@ -280,7 +280,7 @@
* -1 on success
*/
static int
-grep_cmp(const unsigned char *pattern, const unsigned char *data, size_t len)
+grep_cmp(const unsigned char *pat, const unsigned char *data, size_t len)
{
int i;
size_t size;
@@ -295,12 +295,12 @@
if (mbstowcs(wdata, (const char *)data, size) == -1)
return (-1);
- if ((size = mbstowcs(NULL, (const char *)pattern, 0)) == -1)
+ if ((size = mbstowcs(NULL, (const char *)pat, 0)) == -1)
return (-1);
wpat = grep_malloc(size * sizeof(wint_t));
- if (mbstowcs(wpat, (const char *)pattern, size) == -1)
+ if (mbstowcs(wpat, (const char *)pat, size) == -1)
return (-1);
for (i = 0; i < len; i++) {
if ((towlower(wpat[i]) == towlower(wdata[i])) || ((grepbehave != GREP_FIXED) && wpat[i] == L'.'))
@@ -311,7 +311,7 @@
}
} else {
for (i = 0; i < len; i++) {
- if ((pattern[i] == data[i]) || ((grepbehave != GREP_FIXED) && pattern[i] == '.'))
+ if ((pat[i] == data[i]) || ((grepbehave != GREP_FIXED) && pat[i] == '.'))
continue;
return (i);
}
==== //depot/projects/soc2008/gabor_textproc/grep/grep.h#49 (text+ko) ====
@@ -146,8 +146,6 @@
void clearqueue(void);
/* file.c */
-unsigned char *binbufptr;
-
void grep_close(struct file *f);
struct file *grep_stdin_open(void);
struct file *grep_open(char *path);
==== //depot/projects/soc2008/gabor_textproc/grep/util.c#82 (text+ko) ====
@@ -66,7 +66,7 @@
FTS *fts;
FTSENT *p;
int i, c, ok, fts_flags;
- char *d, *dirname;
+ char *d, *dir;
c = fts_flags = 0;
@@ -101,8 +101,8 @@
ok = 1;
if (exclflag) {
d = strrchr(p->fts_path, '/');
- dirname = grep_malloc(sizeof(char) * (d - p->fts_path + 2));
- strlcpy(dirname, p->fts_path, (d - p->fts_path + 1));
+ dir = grep_malloc(sizeof(char) * (d - p->fts_path + 2));
+ strlcpy(dir, p->fts_path, (d - p->fts_path + 1));
for (i = 0; i < epatterns; ++i) {
switch(epattern[i].type) {
case FILE_PAT:
@@ -114,7 +114,7 @@
}
break;
case DIR_PAT:
- if (strstr(dirname, epattern[i].pat) != NULL) {
+ if (strstr(dir, epattern[i].pat) != NULL) {
if (epattern[i].mode == EXCL_PAT)
ok = 0;
else
@@ -123,7 +123,7 @@
break;
}
}
- free(dirname);
+ free(dir);
}
if (ok)
@@ -253,9 +253,6 @@
regmatch_t matches[MAX_LINE_MATCHES];
regoff_t st = 0;
int c = 0, i, r = 0, m = 0;
-#ifdef WITH_PCRE
- int ovector[3];
-#endif
if (!matchall) {
/* Loop to process the whole line */
More information about the p4-projects
mailing list