if (len)
p = oldp;
else if (UTF) {
+ STRLEN unilen;
+
if (FOLD) {
/* Emit all the Unicode characters. */
for (foldbuf = tmpbuf;
foldlen -= numlen) {
ender = utf8_to_uvchr(foldbuf, &numlen);
if (numlen > 0) {
- reguni(pRExC_state, ender, s, &numlen);
- s += numlen;
- len += numlen;
+ reguni(pRExC_state, ender, s, &unilen);
+ s += unilen;
+ len += unilen;
+ /* In EBCDIC the numlen
+ * and unilen can differ. */
foldbuf += numlen;
if (numlen >= foldlen)
break;
}
}
else {
- reguni(pRExC_state, ender, s, &numlen);
+ reguni(pRExC_state, ender, s, &unilen);
if (numlen > 0) {
- s += numlen;
- len += numlen;
+ s += unilen;
+ len += unilen;
}
}
}
break;
}
if (UTF) {
+ STRLEN unilen;
+
if (FOLD) {
/* Emit all the Unicode characters. */
for (foldbuf = tmpbuf;
foldlen -= numlen) {
ender = utf8_to_uvchr(foldbuf, &numlen);
if (numlen > 0) {
- reguni(pRExC_state, ender, s, &numlen);
- len += numlen;
- s += numlen;
+ reguni(pRExC_state, ender, s, &unilen);
+ len += unilen;
+ s += unilen;
+ /* In EBCDIC the numlen
+ * and unilen can differ. */
foldbuf += numlen;
if (numlen >= foldlen)
break;
}
}
else {
- reguni(pRExC_state, ender, s, &numlen);
+ reguni(pRExC_state, ender, s, &unilen);
if (numlen > 0) {
- s += numlen;
- len += numlen;
+ s += unilen;
+ len += unilen;
}
}
len--;
UV
Perl_to_uni_upper(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
- uvchr_to_utf8(tmpbuf, c);
- return to_utf8_upper(tmpbuf, p, lenp);
+ uvchr_to_utf8(p, c);
+ return to_utf8_upper(p, p, lenp);
}
UV
Perl_to_uni_title(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
- uvchr_to_utf8(tmpbuf, c);
- return to_utf8_title(tmpbuf, p, lenp);
+ uvchr_to_utf8(p, c);
+ return to_utf8_title(p, p, lenp);
}
UV
Perl_to_uni_lower(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
- uvchr_to_utf8(tmpbuf, c);
- return to_utf8_lower(tmpbuf, p, lenp);
+ uvchr_to_utf8(p, c);
+ return to_utf8_lower(p, p, lenp);
}
UV
Perl_to_uni_fold(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN_FOLD+1];
- uvchr_to_utf8(tmpbuf, c);
- return to_utf8_fold(tmpbuf, p, lenp);
+ uvchr_to_utf8(p, c);
+ return to_utf8_fold(p, p, lenp);
}
/* for now these all assume no locale info available for Unicode > 255 */