PERFORCE change 174403 for review
Gabor Kovesdan
gabor at FreeBSD.org
Sat Feb 6 15:00:32 UTC 2010
http://p4web.freebsd.org/chv.cgi?CH=174403
Change 174403 by gabor at gabor_server on 2010/02/06 15:00:02
- style(9)
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/grep/fastgrep.c#17 edit
.. //depot/projects/soc2008/gabor_textproc/grep/file.c#49 edit
.. //depot/projects/soc2008/gabor_textproc/grep/grep.c#93 edit
.. //depot/projects/soc2008/gabor_textproc/grep/grep.h#53 edit
.. //depot/projects/soc2008/gabor_textproc/grep/queue.c#10 edit
.. //depot/projects/soc2008/gabor_textproc/grep/util.c#87 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/grep/fastgrep.c#17 (text+ko) ====
@@ -52,7 +52,7 @@
void
fgrepcomp(fastgrep_t *fg, const char *pat)
{
- unsigned int i;
+ unsigned int i;
/* Initialize. */
fg->len = strlen(pat);
@@ -76,14 +76,14 @@
int
fastcomp(fastgrep_t *fg, const char *pat)
{
- unsigned int i;
- bool bol = false;
- bool eol = false;
- int shiftPatternLen;
- int hasDot = 0;
- int firstHalfDot = -1;
- int firstLastHalfDot = -1;
- int lastHalfDot = 0;
+ unsigned int i;
+ int firstHalfDot = -1;
+ int firstLastHalfDot = -1;
+ int hasDot = 0;
+ int lastHalfDot = 0;
+ int shiftPatternLen;
+ bool bol = false;
+ bool eol = false;
/* Initialize. */
fg->len = strlen(pat);
@@ -201,8 +201,8 @@
int
grep_search(fastgrep_t *fg, unsigned char *data, size_t len, regmatch_t *pmatch)
{
- unsigned int j;
- int ret = REG_NOMATCH;
+ unsigned int j;
+ int ret = REG_NOMATCH;
if (pmatch->rm_so == (ssize_t)len)
return (ret);
@@ -280,9 +280,9 @@
static int
grep_cmp(const unsigned char *pat, const unsigned char *data, size_t len)
{
- unsigned int i;
- size_t size;
- wchar_t *wdata, *wpat;
+ size_t size;
+ wchar_t *wdata, *wpat;
+ unsigned int i;
if (iflag) {
if ((size = mbstowcs(NULL, (const char *)data, 0)) == ((size_t) - 1))
@@ -320,8 +320,8 @@
static void
grep_revstr(unsigned char *str, int len)
{
- int i;
- char c;
+ int i;
+ char c;
for (i = 0; i < len / 2; i++) {
c = str[i];
==== //depot/projects/soc2008/gabor_textproc/grep/file.c#49 (text+ko) ====
@@ -69,7 +69,7 @@
int
grep_fgetc(struct file *f)
{
- unsigned char c;
+ unsigned char c;
switch (filebehave) {
case FILE_STDIO:
@@ -117,9 +117,9 @@
char *
grep_fgetln(struct file *f, size_t *len)
{
- int ch = 0;
- struct stat st;
- size_t bufsiz, i = 0;
+ struct stat st;
+ size_t bufsiz, i = 0;
+ int ch = 0;
/* Fill in the buffer if it is empty. */
if (binbufptr == NULL) {
@@ -178,7 +178,7 @@
struct file *
grep_stdin_open(void)
{
- struct file *f;
+ struct file *f;
snprintf(fname, sizeof fname, getstr(1));
@@ -199,7 +199,7 @@
struct file *
grep_open(const char *path)
{
- struct file *f;
+ struct file *f;
snprintf(fname, sizeof fname, "%s", path);
==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#93 (text+ko) ====
@@ -262,9 +262,9 @@
static void
read_patterns(const char *fn)
{
- FILE *f;
- char *line;
- size_t len;
+ FILE *f;
+ char *line;
+ size_t len;
if ((f = fopen(fn, "r")) == NULL)
err(2, "%s", fn);
@@ -278,11 +278,11 @@
int
main(int argc, char *argv[])
{
- int c, lastc, prevoptind, newarg, needpattern;
- unsigned int i, eargc, aargc;
- char *ep;
unsigned long long l;
- char **eargv, **aargv, *eopts;
+ char **aargv, **eargv, *eopts;
+ char *ep;
+ unsigned int aargc, eargc, i;
+ int c, lastc, needpattern, newarg, prevoptind;
setlocale(LC_ALL, "");
@@ -328,7 +328,7 @@
eargc = 1;
if (eopts != NULL) {
- char *str;
+ char *str;
for(i = 0; i < strlen(eopts); i++)
if (eopts[i] == ' ')
==== //depot/projects/soc2008/gabor_textproc/grep/grep.h#53 (text+ko) ====
@@ -78,31 +78,31 @@
#define MAX_LINE_MATCHES 32
struct file {
+ struct mmfile *mmf;
+ BZFILE *bzf;
+ FILE *f;
+ gzFile *gzf;
bool binary;
bool stdin;
- FILE *f;
- struct mmfile *mmf;
- gzFile *gzf;
- BZFILE *bzf;
};
struct str {
+ off_t off;
size_t len;
+ char *dat;
+ char *file;
int line_no;
- off_t off;
- char *file;
- char *dat;
};
struct epat {
char *pat;
+ int mode;
int type;
- int mode;
};
typedef struct {
+ size_t len;
unsigned char *pattern;
- size_t len;
int qsBc[UCHAR_MAX + 1];
/* flags */
bool bol;
@@ -117,17 +117,17 @@
extern bool Eflag, Fflag, Gflag, Hflag, Lflag,
bflag, cflag, hflag, iflag, lflag, mflag, nflag, oflag,
qflag, sflag, vflag, wflag, xflag;
-extern bool nullflag, exclflag;
+extern bool exclflag, nullflag;
extern unsigned long long Aflag, Bflag, mcount;
extern char *color, *label;
-extern int grepbehave, binbehave, filebehave, devbehave, dirbehave, linkbehave;
+extern int binbehave, devbehave, dirbehave, filebehave, grepbehave, linkbehave;
-extern bool matchall, first, prev, notfound;
+extern bool first, matchall, notfound, prev;
extern int tail;
-extern unsigned int patterns, epatterns;
+extern unsigned int epatterns, patterns;
extern char **pattern;
extern struct epat *epattern;
-extern regex_t *r_pattern, *er_pattern;
+extern regex_t *er_pattern, *r_pattern;
extern fastgrep_t *fg_pattern;
/* For regex errors */
==== //depot/projects/soc2008/gabor_textproc/grep/queue.c#10 (text+ko) ====
@@ -53,7 +53,7 @@
void
enqueue(struct str *x)
{
- struct qentry *item;
+ struct qentry *item;
item = grep_malloc(sizeof(struct qentry));
item->data.dat = grep_malloc(sizeof(char) * x->len);
@@ -72,7 +72,7 @@
static struct qentry *
dequeue(void)
{
- struct qentry *item;
+ struct qentry *item;
item = STAILQ_FIRST(&queue);
if (item == NULL)
@@ -86,7 +86,7 @@
void
printqueue(void)
{
- struct qentry *item;
+ struct qentry *item;
while ((item = dequeue()) != NULL) {
printline(&item->data, '-', (regmatch_t *)NULL, 0);
@@ -97,7 +97,7 @@
void
clearqueue(void)
{
- struct qentry *item;
+ struct qentry *item;
while ((item = dequeue()) != NULL)
free(item);
==== //depot/projects/soc2008/gabor_textproc/grep/util.c#87 (text+ko) ====
@@ -56,11 +56,11 @@
int
grep_tree(char **argv)
{
- FTS *fts;
- FTSENT *p;
- int c, ok, fts_flags;
- char *d, *dir;
- unsigned int i;
+ FTS *fts;
+ FTSENT *p;
+ char *d, *dir;
+ unsigned int i;
+ int c, fts_flags, ok;
c = fts_flags = 0;
@@ -138,11 +138,11 @@
int
procfile(const char *fn)
{
- struct str ln;
- struct file *f;
- struct stat sb;
- mode_t s;
- int c, t;
+ struct file *f;
+ struct stat sb;
+ struct str ln;
+ mode_t s;
+ int c, t;
if (mflag && (mcount <= 0))
return (0);
@@ -246,11 +246,11 @@
static int
procline(struct str *l, int nottext)
{
- regmatch_t pmatch;
- regmatch_t matches[MAX_LINE_MATCHES];
- size_t st = 0;
- int c = 0, r = 0, m = 0;
- unsigned int i;
+ regmatch_t matches[MAX_LINE_MATCHES];
+ regmatch_t pmatch;
+ size_t st = 0;
+ unsigned int i;
+ int c = 0, m = 0, r = 0;
if (!matchall) {
/* Loop to process the whole line */
@@ -282,9 +282,9 @@
r = REG_NOMATCH;
/* Check for whole word match */
if (r == 0 && wflag && pmatch.rm_so != 0 && (size_t)pmatch.rm_eo != l->len) {
- wchar_t *wbegin;
- wint_t wend;
- size_t size;
+ wchar_t *wbegin;
+ wint_t wend;
+ size_t size;
size = mbstowcs(NULL, l->dat, pmatch.rm_so);
@@ -357,7 +357,7 @@
void *
grep_malloc(size_t size)
{
- void *ptr;
+ void *ptr;
if ((ptr = malloc(size)) == NULL)
err(2, "malloc");
@@ -370,7 +370,7 @@
void *
grep_calloc(size_t nmemb, size_t size)
{
- void *ptr;
+ void *ptr;
if ((ptr = calloc(nmemb, size)) == NULL)
err(2, "calloc");
@@ -395,8 +395,8 @@
void
printline(struct str *line, int sep, regmatch_t *matches, int m)
{
- int i, n = 0;
- size_t a = 0;
+ size_t a = 0;
+ int i, n = 0;
if (!hflag) {
if (nullflag == 0)
More information about the p4-projects
mailing list