const char *src;
unsigned char *dst;
{
- static const char xdigits_l[] = "0123456789abcdef",
- xdigits_u[] = "0123456789ABCDEF";
unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
const char *xdigits, *curtok;
int ch, saw_xdigit;
while ((ch = *src++) != '\0') {
const char *pch;
- if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
- pch = strchr((xdigits = xdigits_u), ch);
+ if ((pch = strchr((xdigits = hexchars_lower), ch)) == NULL)
+ pch = strchr((xdigits = hexchars_upper), ch);
if (pch != NULL) {
val <<= 4;
val |= (pch - xdigits);
return renameat(__oldfd, __old, __newfd, __new);
}
#endif /* ! HAVE_RENAMEAT2 */
+
+const char hexchars_lower[] = "0123456789abcdef";
+const char hexchars_upper[] = "0123456789ABCDEF";
if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
do {
- convert[place++] =
- (caps? "0123456789ABCDEF":"0123456789abcdef")
- [uvalue % (unsigned)base ];
+ convert[place++] = (caps ? hex_upper
+ : hex_lower)[uvalue % (unsigned)base];
uvalue = (uvalue / (unsigned)base );
} while(uvalue && (place < sizeof(convert)));
if (place == sizeof(convert)) place--;
idx = (int) ((temp -intpart +0.05)* 10.0);
/* idx = (int) (((double)(temp*0.1) -intpart +0.05) *10.0); */
/* printf ("%llf, %f, %x\n", temp, intpart, idx); */
- iconvert[iplace++] =
- (caps? "0123456789ABCDEF":"0123456789abcdef")[idx];
+ iconvert[iplace++] = (caps ? hexchars_upper
+ : hexchars_lower)[idx];
} while (intpart && (iplace < 311));
if (iplace == 311) iplace--;
iconvert[iplace] = 0;
idx = (int) ((temp -fracpart +0.05)* 10.0);
/* idx = (int) ((((temp/10) -fracpart) +0.05) *10); */
/* printf ("%lf, %lf, %ld\n", temp, fracpart, idx ); */
- fconvert[fplace++] =
- (caps? "0123456789ABCDEF":"0123456789abcdef")[idx];
+ fconvert[fplace++] = (caps ? hexchars_upper
+ : hexchars_lower)[idx];
} while(fracpart && (fplace < 311));
if (fplace == 311) fplace--;
}