Date: Thu, 31 Jul 2008 13:58:14 GMT From: Gabor Kovesdan <gabor@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 146317 for review Message-ID: <200807311358.m6VDwEVh089755@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=146317 Change 146317 by gabor@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])) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807311358.m6VDwEVh089755>