From 0b2f84322abb7d25b04069af43b20424b7812bde Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 21 Mar 2014 12:47:34 +0000 Subject: [PATCH] Eliding a variable. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4660 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/chars.c | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 215b9501..2d2c15f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-03-21 Benno Schulenberg + * src/chars.c (is_punct_mbchar, mbstrchr) - Elide a variable, + thus making two ifs identical to six others. + 2014-03-19 Benno Schulenberg * doc/nanorc.sample.in - Document the changed whitespace defaults. * src/global.c, doc/man/nanorc.5 - Allow softwrap to be rebound. diff --git a/src/chars.c b/src/chars.c index 474c913f..67eb0df3 100644 --- a/src/chars.c +++ b/src/chars.c @@ -184,9 +184,8 @@ bool is_punct_mbchar(const char *c) #ifdef ENABLE_UTF8 if (use_utf8) { wchar_t wc; - int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX); - if (c_mb_len < 0) { + if (mbtowc(&wc, c, MB_CUR_MAX) < 0) { mbtowc_reset(); wc = bad_wchar; } @@ -788,9 +787,8 @@ char *mbstrchr(const char *s, const char *c) char *s_mb = charalloc(MB_CUR_MAX); const char *q = s; wchar_t ws, wc; - int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX); - if (c_mb_len < 0) { + if (mbtowc(&wc, c, MB_CUR_MAX) < 0) { mbtowc_reset(); wc = (unsigned char)*c; bad_c_mb = TRUE; -- 2.39.5