Date: Thu, 1 May 2008 17:09:49 GMT From: Gabor Kovesdan <gabor@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 140992 for review Message-ID: <200805011709.m41H9nxa037284@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=140992 Change 140992 by gabor@gabor_server on 2008/05/01 17:09:30 - style(9) Affected files ... .. //depot/projects/soc2008/gabor_textproc/sort/files.c#2 edit .. //depot/projects/soc2008/gabor_textproc/sort/fsort.h#2 edit .. //depot/projects/soc2008/gabor_textproc/sort/init.c#3 edit .. //depot/projects/soc2008/gabor_textproc/sort/sort.c#3 edit Differences ... ==== //depot/projects/soc2008/gabor_textproc/sort/files.c#2 (text+ko) ==== @@ -43,11 +43,11 @@ #endif #endif /* not lint */ +#include <string.h> + #include "sort.h" #include "fsort.h" -#include <string.h> - static int seq(FILE *, DBT *, DBT *); /* @@ -58,12 +58,12 @@ getnext(int binno, union f_handle infl0, int nfiles, RECHEADER *pos, u_char *end, struct field *dummy) { - int i; - u_char *hp; - static size_t nleft = 0; - static int cnt = 0, flag = -1; - static u_char maxb = 0; - static FILE *fp; + int i; + u_char *hp; + static size_t nleft = 0; + static int cnt = 0, flag = -1; + static u_char maxb = 0; + static FILE *fp; if (nleft == 0) { if (binno < 0) /* reset files. */ { @@ -125,12 +125,12 @@ makeline(int flno, union f_handle filelist, int nfiles, RECHEADER *buffer, u_char *bufend, struct field *dummy2) { - static u_char *obufend; - static size_t osz; - char *pos; - static int fileno = 0, overflow = 0; - static FILE *fp = 0; - int c; + static u_char *obufend; + static size_t osz; + char *pos; + static int fileno = 0, overflow = 0; + static FILE *fp = 0; + int c; pos = (char *) buffer->data; if (overflow) { @@ -205,11 +205,11 @@ makekey(int flno, union f_handle filelist, int nfiles, RECHEADER *buffer, u_char *bufend, struct field *ftbl) { - static int fileno = 0; - static FILE *dbdesc = 0; - static DBT dbkey[1], line[1]; - static int overflow = 0; - static int c; + static int fileno = 0; + static FILE *dbdesc = 0; + static DBT dbkey[1], line[1]; + static int overflow = 0; + static int c; if (overflow) { overflow = enterkey(buffer, line, bufend - (u_char *)buffer, @@ -263,9 +263,9 @@ static int seq(FILE *fp, DBT *line, DBT *key) { - static char *buf, flag = 1; - char *end, *pos; - int c; + static char *buf, flag = 1; + char *end, *pos; + int c; if (flag) { flag = 0; @@ -305,6 +305,7 @@ void putrec(RECHEADER *rec, FILE *fp) { + EWRITE(rec, 1, rec->length + sizeof(TRECHEADER), fp); } @@ -314,6 +315,7 @@ void putline(RECHEADER *rec, FILE *fp) { + EWRITE(rec->data+rec->offset, 1, rec->length - rec->offset, fp); } @@ -324,8 +326,8 @@ geteasy(int flno, union f_handle filelist, int nfiles, RECHEADER *rec, u_char *end, struct field *dummy2) { - int i; - FILE *fp; + int i; + FILE *fp; fp = fstack[flno].fp; if ((u_char *) rec > end - sizeof(TRECHEADER)) ==== //depot/projects/soc2008/gabor_textproc/sort/fsort.h#2 (text+ko) ==== @@ -1,4 +1,5 @@ /* $OpenBSD: fsort.h,v 1.10 2007/03/13 17:33:58 millert Exp $ */ +/* $FreeBSD$ */ /*- * Copyright (c) 1993 @@ -34,16 +35,16 @@ * @(#)fsort.h 8.1 (Berkeley) 6/6/93 */ -#define POW 20 /* exponent for buffer size */ -#define BUFSIZE (1 << POW) -#define MAXNUM (BUFSIZE/10) /* lowish guess at average record size */ -#define BUFFEND (EOF-2) -#define BUFFSMALL (EOF-3) /* buffer is too small to hold line */ -#define MAXFCT 1000 -#define MAXLLEN ((1 << min(POW-4, 16)) - 14) +#define POW 20 /* exponent for buffer size */ +#define BUFSIZE (1 << POW) +#define MAXNUM (BUFSIZE/10) /* lowish guess at average record size */ +#define BUFFEND (EOF-2) +#define BUFFSMALL (EOF-3) /* buffer is too small to hold line */ +#define MAXFCT 1000 +#define MAXLLEN ((1 << min(POW-4, 16)) - 14) -extern u_char *linebuf; -extern size_t linebuf_size; +extern u_char *linebuf; +extern size_t linebuf_size; /* temp files in the stack have a file descriptor, a largest bin (maxb) * which becomes the last non-empty bin (lastb) when the actual largest @@ -52,9 +53,9 @@ * are sorted. */ struct tempfile { - FILE *fp; - u_char maxb; - u_char lastb; - int max_o; + FILE *fp; + u_char maxb; + u_char lastb; + int max_o; }; -extern struct tempfile fstack[MAXFCT]; +extern struct tempfile fstack[MAXFCT]; ==== //depot/projects/soc2008/gabor_textproc/sort/init.c#3 (text+ko) ==== @@ -203,12 +203,18 @@ return (BI); else return (BT); - case 'd': return (D); - case 'f': return (F); - case 'i': return (I); - case 'n': return (N); - case 'r': return (R); - default: return (0); + case 'd': + return (D); + case 'f': + return (F); + case 'i': + return (I); + case 'n': + return (N); + case 'r': + return (R); + default: + return (0); } } ==== //depot/projects/soc2008/gabor_textproc/sort/sort.c#3 (text+ko) ==== @@ -50,8 +50,8 @@ * Sort uses radix sort for internal sorting, and allows * a choice of merge sort and radix sort for external sorting. */ +#include <sys/stat.h> #include <sys/types.h> -#include <sys/stat.h> #include <err.h> #include <getopt.h>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805011709.m41H9nxa037284>