summaryrefslogtreecommitdiff
path: root/src/wc.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-10-10 22:57:07 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-10-10 22:57:07 +0000
commite245a66054cac00f2916fbc9436d926ea2cf4d1c (patch)
treeb36a56e3bede31be2c78a76e0bfe7db73670587a /src/wc.c
parent489ff7f0cdaa63403aefcce778ea7214dc4e6808 (diff)
downloadcoreutils-e245a66054cac00f2916fbc9436d926ea2cf4d1c.tar.xz
* src/ls.c (quote_name): Use initializer rather than memset to
initialize an object to zero. This is easier to read and is less likely to introduce an runtime error due to a mixup. It causes gcc -W to issue a warning, but you can work around this by appending -Wno-missing-field-initializers. * src/pathchk.c (portable_chars_only): Likewise. * src/shred.c (main): Likewise. * src/stty.c (main): Likewise. * src/tr.c (card_of_complement): Likewise. * src/wc.c (wc): Likewise.
Diffstat (limited to 'src/wc.c')
-rw-r--r--src/wc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/wc.c b/src/wc.c
index e21fb7f05..332f32dc4 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -273,7 +273,7 @@ wc (int fd, char const *file_x, struct fstatus *fstatus)
{
bool in_word = false;
uintmax_t linepos = 0;
- mbstate_t state;
+ mbstate_t state = { 0, };
uintmax_t last_error_line = 0;
int last_error_errno = 0;
# if SUPPORT_OLD_MBRTOWC
@@ -289,7 +289,6 @@ wc (int fd, char const *file_x, struct fstatus *fstatus)
const size_t prev = 0;
# endif
- memset (&state, 0, sizeof (mbstate_t));
while ((bytes_read = safe_read (fd, buf + prev, BUFFER_SIZE - prev)) > 0)
{
const char *p;