iconv: Fix a pointer mismatch.

Catch NULL pointer earlier, check for empty string later.
Apparently this fixes a GCC8 warning.

Obtained from:	NetBSD (CVS Rev. 1.21, 1.22) through DragonFlyBSD
MFC after:	1 week
This commit is contained in:
Pedro F. Giffuni 2017-11-20 20:05:30 +00:00
parent 981e34b9ca
commit 2b61d29172
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326028

View File

@ -164,7 +164,7 @@ _citrus_NONE_stdenc_mbtowc(struct _citrus_stdenc * __restrict ce __unused,
struct iconv_hooks *hooks)
{
if (s == NULL) {
if (*s == NULL) {
*nresult = 0;
return (0);
}
@ -176,7 +176,7 @@ _citrus_NONE_stdenc_mbtowc(struct _citrus_stdenc * __restrict ce __unused,
if (pwc != NULL)
*pwc = (_wc_t)(unsigned char) **s;
*nresult = *s == '\0' ? 0 : 1;
*nresult = **s == '\0' ? 0 : 1;
if ((hooks != NULL) && (hooks->wc_hook != NULL))
hooks->wc_hook(*pwc, hooks->data);