PERFORCE change 146317 for review
Gabor Kovesdan
gabor at FreeBSD.org
Thu Jul 31 13:58:15 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=146317
Change 146317 by gabor at gabor_server on 2008/07/31 13:57:32
- Little improvement in the code with a sizeof expression
Reported by: fjoe (mentor)
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/grep/file.c#29 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/grep/file.c#29 (text+ko) ====
@@ -128,7 +128,7 @@
if (binbufptr == NULL) {
/* Only pre-read to the buffer if we need the binary check. */
if (binbehave != BINFILE_TEXT) {
- for (; (i < (BUFSIZ * sizeof(wint_t))) && !grep_feof(f); i++) {
+ for (; i < sizeof(wbinbuf) && !grep_feof(f); i++) {
ch = grep_fgetc(f);
binbuf[i] = ch;
}
@@ -137,7 +137,7 @@
/* Convert at most (BUFSIZ * sizeof(wint_t)) characters or
(BUFSIZ - 1) bytes to wide character string. */
- size = mbsnrtowcs(wbinbuf, &src, BUFSIZ * sizeof(wint_t), BUFSIZ - 1, &mbs);
+ size = mbsnrtowcs(wbinbuf, &src, sizeof(wbinbuf), BUFSIZ - 1, &mbs);
f->binary = 0;
for (; size > 0; size--)
if (iswbinary(wbinbuf[size])) {
More information about the p4-projects
mailing list