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

more bug fixes in generation of rdatatype_fromtext() processing

This commit is contained in:
Michael Graff
2000-04-26 18:30:04 +00:00
parent e8c91210aa
commit 95f908eb79

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: gen.c,v 1.41 2000/04/26 17:27:01 explorer Exp $ */ /* $Id: gen.c,v 1.42 2000/04/26 18:30:04 explorer Exp $ */
#include <config.h> #include <config.h>
@@ -634,6 +634,16 @@ main(int argc, char **argv) {
* Here, walk the list from top to bottom, calculating * Here, walk the list from top to bottom, calculating
* the hash (mod 256) for each name. * the hash (mod 256) for each name.
*/ */
printf("#define RDATATYPE_COMPARE(_s, _d, _tn, _tp) \\\n");
printf("\tdo { \\\n");
printf("\t\tif (strcasecmp(_s,(_tn)) == 0) { \\\n");
printf("\t\t\tif ((typeattr[_d].flags & DNS_RDATATYPEATTR_RESERVED) != 0) \\\n");
printf("\t\t\t\treturn (ISC_R_NOTIMPLEMENTED); \\\n");
printf("\t\t\t*(_tp) = _d; \\\n");
printf("\t\t\treturn (ISC_R_SUCCESS); \\\n");
printf("\t\t} \\\n");
printf("\t} while (0)\n\n");
printf("#define RDATATYPE_FROMTEXT_SW(_hash,_typename,_typep) \\\n"); printf("#define RDATATYPE_FROMTEXT_SW(_hash,_typename,_typep) \\\n");
printf("\tswitch (_hash) { \\\n"); printf("\tswitch (_hash) { \\\n");
for (i = 0 ; i <= 255 ; i++) { for (i = 0 ; i <= 255 ; i++) {
@@ -652,18 +662,13 @@ main(int argc, char **argv) {
* Find all other entries that happen to match * Find all other entries that happen to match
* this hash. * this hash.
*/ */
for (j = i ; j <= 255 ; j++) { for (j = 0 ; j <= 255 ; j++) {
ttn2 = &typenames[j]; ttn2 = &typenames[j];
if (ttn->sorted != 0) if (ttn2->sorted != 0)
continue; continue;
if (hash == HASH(ttn2->typename)) { if (hash == HASH(ttn2->typename)) {
printf("\t\t\tif (strcasecmp(\"%s\", (_typename)) == 0) { \\\n" printf("\t\t\tRDATATYPE_COMPARE(\"%s\", %u, _typename, _typep); \\\n",
"\t\t\t\tif ((typeattr[%u].flags & DNS_RDATATYPEATTR_RESERVED) != 0) \\\n" ttn2->typename, j);
"\t\t\t\t\treturn (ISC_R_NOTIMPLEMENTED); \\\n"
"\t\t\t\t*(_typep) = %u; \\\n"
"\t\t\t\treturn (ISC_R_SUCCESS); \\\n"
"\t\t\t} \\\n",
ttn2->typename, j, j);
ttn2->sorted = 1; ttn2->sorted = 1;
} }
} }