2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Consolidate some ASCII tables in isc/ascii and isc/hex

There were a number of places that had copies of various ASCII
tables (case conversion, hex and decimal conversion) that are intended
to be faster than the ctype.h macros, or avoid locale pollution.

Move them into libisc, and wrap the lookup tables with macros that
avoid the ctype.h gotchas.
This commit is contained in:
Tony Finch
2022-06-24 22:11:02 +01:00
parent db3590e0b7
commit 27a561273e
18 changed files with 251 additions and 274 deletions

View File

@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <isc/ascii.h>
#include <isc/buffer.h>
#include <isc/parseint.h>
#include <isc/print.h>
@@ -119,13 +120,10 @@ dns_ttl_totext(uint32_t src, bool verbose, bool upcase, isc_buffer_t *target) {
/*
* The unit letter is the last character in the
* used region of the buffer.
*
* toupper() does not need its argument to be masked of cast
* here because region.base is type unsigned char *.
*/
isc_buffer_usedregion(target, &region);
region.base[region.length - 1] =
toupper(region.base[region.length - 1]);
isc_ascii_toupper(region.base[region.length - 1]);
}
return (ISC_R_SUCCESS);
}