ref: cf53466908f62e688c10bf2d849869c18f694191
parent: be9cf8dc7901917dd8857a89c895424fad52c956
author: ftrvxmtrx <devnull@localhost>
date: Sat May 3 06:48:13 EDT 2014
uniq: use Bsize for buffers
--- a/sys/src/cmd/uniq.c
+++ b/sys/src/cmd/uniq.c
@@ -6,8 +6,6 @@
#include <bio.h>
#include <ctype.h>
-#define SIZE 8000
-
int fields = 0;
int letters = 0;
int linec = 0;
@@ -14,7 +12,6 @@
char mode;
int uniq;
char *b1, *b2;
-long bsize;
Biobuf fin;
Biobuf fout;
@@ -29,9 +26,8 @@
int f;
argv0 = argv[0];
- bsize = SIZE;
- b1 = malloc(bsize);
- b2 = malloc(bsize);
+ b1 = malloc(Bsize);
+ b2 = malloc(Bsize);
f = 0;
while(argc > 1) { if(*argv[1] == '-') {@@ -93,7 +89,7 @@
if(p == 0)
return 1;
len = Blinelen(&fin);
- if(len >= bsize-1)
+ if(len > Bsize)
sysfatal("line too long");memmove(buf, p, len);
buf[len-1] = 0;
--
⑨