Mercurial > hg > octave-nkf > gnulib-hg
changeset 14374:85a5ffbc0cb3
mbrtowc: Tiny optimization.
* lib/mbrtowc.c (mbrtowc): Delay pstate assignment until it is needed.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 21 Feb 2011 05:07:14 +0100 |
parents | dc61f43340a6 |
children | 5c0504048541 |
files | ChangeLog lib/mbrtowc.c |
diffstat | 2 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-02-20 Bruno Haible <bruno@clisp.org> + + mbrtowc: Tiny optimization. + * lib/mbrtowc.c (mbrtowc): Delay pstate assignment until it is needed. + 2011-02-20 Jim Meyering <meyering@redhat.com> test-exclude.c: remove unmatched #endif
--- a/lib/mbrtowc.c +++ b/lib/mbrtowc.c @@ -40,9 +40,6 @@ { char *pstate = (char *)ps; - if (pstate == NULL) - pstate = internal_state; - if (s == NULL) { pwc = NULL; @@ -54,6 +51,10 @@ return (size_t)(-2); /* Here n > 0. */ + + if (pstate == NULL) + pstate = internal_state; + { size_t nstate = pstate[0]; char buf[4];