PERFORCE change 141256 for review
Gabor Kovesdan
gabor at FreeBSD.org
Tue May 6 22:10:23 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=141256
Change 141256 by gabor at gabor_server on 2008/05/06 22:09:30
- Use new naming convention for structs
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/grep/binary.c#3 edit
.. //depot/projects/soc2008/gabor_textproc/grep/file.c#3 edit
.. //depot/projects/soc2008/gabor_textproc/grep/grep.c#3 edit
.. //depot/projects/soc2008/gabor_textproc/grep/grep.h#4 edit
.. //depot/projects/soc2008/gabor_textproc/grep/mmfile.c#3 edit
.. //depot/projects/soc2008/gabor_textproc/grep/queue.c#4 edit
.. //depot/projects/soc2008/gabor_textproc/grep/util.c#4 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/grep/binary.c#3 (text+ko) ====
@@ -91,7 +91,7 @@
}
int
-mmbin_file(mmf_t *f)
+mmbin_file(struct mmfile *f)
{
int i;
==== //depot/projects/soc2008/gabor_textproc/grep/file.c#3 (text+ko) ====
@@ -53,11 +53,11 @@
#define FILE_GZIP 2
struct file {
- int type;
- int noseek;
- FILE *f;
- mmf_t *mmf;
- gzFile *gzf;
+ int type;
+ int noseek;
+ FILE *f;
+ struct mmfile *mmf;
+ gzFile *gzf;
};
static char *
@@ -96,10 +96,10 @@
return (lnbuf);
}
-file_t *
+struct file *
grep_fdopen(int fd, char *mode)
{
- file_t *f;
+ struct file *f;
if (fd == STDIN_FILENO)
snprintf(fname, sizeof fname, "(standard input)");
@@ -125,10 +125,10 @@
return (NULL);
}
-file_t *
+struct file *
grep_open(char *path, char *mode)
{
- file_t *f;
+ struct file *f;
snprintf(fname, sizeof fname, "%s", path);
@@ -156,7 +156,7 @@
}
int
-grep_bin_file(file_t *f)
+grep_bin_file(struct file *f)
{
if (f->noseek)
return (0);
@@ -175,7 +175,7 @@
}
char *
-grep_fgetln(file_t *f, size_t *l)
+grep_fgetln(struct file *f, size_t *l)
{
switch (f->type) {
case FILE_STDIO:
@@ -191,7 +191,7 @@
}
void
-grep_close(file_t *f)
+grep_close(struct file *f)
{
switch (f->type) {
case FILE_STDIO:
==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#3 (text+ko) ====
@@ -59,7 +59,7 @@
int patterns, pattern_sz;
char **pattern;
regex_t *r_pattern;
-fastgrep_t *fg_pattern;
+struct fastgrep *fg_pattern;
/* For regex errors */
char re_error[RE_ERROR_BUF + 1];
==== //depot/projects/soc2008/gabor_textproc/grep/grep.h#4 (text+ko) ====
@@ -37,15 +37,15 @@
#define BIN_FILE_SKIP 1
#define BIN_FILE_TEXT 2
-typedef struct str {
+struct str {
size_t len;
int line_no;
off_t off;
char *file;
char *dat;
-} str_t ;
+};
-typedef struct {
+struct fastgrep {
unsigned char *pattern;
int patternLen;
int qsBc[UCHAR_MAX + 1];
@@ -54,7 +54,7 @@
int eol;
int wmatch;
int reversedSearch;
-} fastgrep_t;
+};
/* Flags passed to regcomp() and regexec() */
extern int cflags, eflags;
@@ -68,7 +68,7 @@
extern int first, matchall, patterns, tail;
extern char **pattern;
-extern fastgrep_t *fg_pattern;
+extern struct fastgrep *fg_pattern;
extern regex_t *r_pattern;
/* For regex errors */
@@ -82,8 +82,8 @@
void *grep_calloc(size_t nmemb, size_t size);
void *grep_realloc(void *ptr, size_t size);
void printline(struct str *line, int sep);
-int fastcomp(fastgrep_t *, const char *);
-void fgrepcomp(fastgrep_t *, const char *);
+int fastcomp(struct fastgrep *, const char *);
+void fgrepcomp(struct fastgrep *, const char *);
/* queue.c */
void initqueue(void);
@@ -92,27 +92,26 @@
void clearqueue(void);
/* mmfile.c */
-typedef struct mmfile {
+struct mmfile {
int fd;
size_t len;
char *base, *end, *ptr;
-} mmf_t;
+};
-mmf_t *mmopen(char *fn, char *mode);
-void mmclose(mmf_t *mmf);
-char *mmfgetln(mmf_t *mmf, size_t *l);
+struct mmfile *mmopen(char *fn, char *mode);
+void mmclose(struct mmfile *mmf);
+char *mmfgetln(struct mmfile *mmf, size_t *l);
/* file.c */
struct file;
-typedef struct file file_t;
-file_t *grep_fdopen(int fd, char *mode);
-file_t *grep_open(char *path, char *mode);
-int grep_bin_file(file_t *f);
-char *grep_fgetln(file_t *f, size_t *l);
-void grep_close(file_t *f);
+struct file *grep_fdopen(int fd, char *mode);
+struct file *grep_open(char *path, char *mode);
+int grep_bin_file(struct file *f);
+char *grep_fgetln(struct file *f, size_t *l);
+void grep_close(struct file *f);
/* binary.c */
int bin_file(FILE * f);
int gzbin_file(gzFile * f);
-int mmbin_file(mmf_t *f);
+int mmbin_file(struct mmfile *f);
==== //depot/projects/soc2008/gabor_textproc/grep/mmfile.c#3 (text+ko) ====
@@ -47,10 +47,10 @@
#define MAX_MAP_LEN 1048576
-mmf_t *
+struct mmfile *
mmopen(char *fn, char *mode)
{
- mmf_t *mmf;
+ struct mmfile *mmf;
struct stat st;
/* XXX ignore mode for now */
@@ -82,7 +82,7 @@
}
void
-mmclose(mmf_t *mmf)
+mmclose(struct mmfile *mmf)
{
munmap(mmf->base, mmf->len);
close(mmf->fd);
@@ -90,7 +90,7 @@
}
char *
-mmfgetln(mmf_t *mmf, size_t *l)
+mmfgetln(struct mmfile *mmf, size_t *l)
{
static char *p;
==== //depot/projects/soc2008/gabor_textproc/grep/queue.c#4 (text+ko) ====
@@ -46,10 +46,10 @@
#include "grep.h"
-typedef struct queue {
+struct queue {
struct queue *next;
struct str data;
-} queue_t ;
+};
static struct queue *q_head, *q_tail;
static int count;
==== //depot/projects/soc2008/gabor_textproc/grep/util.c#4 (text+ko) ====
@@ -56,7 +56,7 @@
static int linesqueued;
static int procline(struct str *l, int);
-static int grep_search(fastgrep_t *, unsigned char *, size_t, regmatch_t *pmatch);
+static int grep_search(struct fastgrep *, unsigned char *, size_t, regmatch_t *pmatch);
static int grep_cmp(const unsigned char *, const unsigned char *, size_t);
static void grep_revstr(unsigned char *, int);
@@ -104,7 +104,7 @@
procfile(char *fn)
{
struct str ln;
- file_t *f;
+ struct file *f;
int c, t, z, nottext;
if (fn == NULL) {
@@ -233,7 +233,7 @@
}
void
-fgrepcomp(fastgrep_t *fg, const char *pattern)
+fgrepcomp(struct fastgrep *fg, const char *pattern)
{
int i;
@@ -275,7 +275,7 @@
* Returns: -1 on failure, 0 on success
*/
int
-fastcomp(fastgrep_t *fg, const char *pattern)
+fastcomp(struct fastgrep *fg, const char *pattern)
{
int i;
int bol = 0;
@@ -431,7 +431,7 @@
e > s && isword(d[s]) && isword(d[e-1]))
static int
-grep_search(fastgrep_t *fg, unsigned char *data, size_t dataLen, regmatch_t *pmatch)
+grep_search(struct fastgrep *fg, unsigned char *data, size_t dataLen, regmatch_t *pmatch)
{
int j;
int rtrnVal = REG_NOMATCH;
More information about the p4-projects
mailing list