these functions were setting wc to point to wchar_t aliasing itself as
a "cheap" way to support null wc arguments. doing so was anything but
cheap, since even without the aliasing violation, it would limit the
compiler's ability to optimize.
making wc point to a dummy object is equally easy and does not suffer
from the above problems.
unsigned c;
const unsigned char *s = (const void *)src;
const unsigned N = n;
+ wchar_t dummy;
if (!st) st = (void *)&internal_state;
c = *(unsigned *)st;
if (!s) {
if (c) goto ilseq;
return 0;
- } else if (!wc) wc = (void *)&wc;
+ } else if (!wc) wc = &dummy;
if (!n) return -2;
if (!c) {
{
unsigned c;
const unsigned char *s = (const void *)src;
+ wchar_t dummy;
if (!s) return 0;
if (!n) goto ilseq;
- if (!wc) wc = (void *)&wc;
+ if (!wc) wc = &dummy;
if (*s < 0x80) return !!(*wc = *s);
if (*s-SA > SB-SA) goto ilseq;