From f3ed36d3a191d6193869a32cee56366ec6e3520a Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 10 Aug 2017 08:44:23 +1000 Subject: [PATCH] 4675. [cleanup] Don't use C++ keyword class. [RT #45726] --- CHANGES | 2 + bin/dig/dighost.c | 12 ++--- bin/tests/db/t_db.c | 86 ++++++++++++++++----------------- bin/tests/master/t_master.c | 7 +-- lib/dns/resolver.c | 11 +++-- lib/dns/spnego.c | 28 +++++------ lib/tests/include/tests/t_api.h | 2 +- lib/tests/t_api.c | 4 +- 8 files changed, 78 insertions(+), 74 deletions(-) diff --git a/CHANGES b/CHANGES index c60cb61bb6..994a8e2b43 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +4675. [cleanup] Don't use C++ keyword class. [RT #45726] + 4673. [port] Silence GCC 7 warnings. [RT #45592] 4672. [bug] Fix a regression introduced by change 3938 (when diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 04ff1cf98c..4ab9eb4a3c 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -240,13 +240,13 @@ isc_result_t prove_nx_domain(dns_message_t * msg, dns_rdataset_t ** sigrdataset); isc_result_t prove_nx_type(dns_message_t * msg, dns_name_t *name, dns_rdataset_t *nsec, - dns_rdataclass_t class, + dns_rdataclass_t rdclass, dns_rdatatype_t type, dns_name_t * rdata_name, dns_rdataset_t ** rdataset, dns_rdataset_t ** sigrdataset); isc_result_t prove_nx(dns_message_t * msg, dns_name_t * name, - dns_rdataclass_t class, + dns_rdataclass_t rdclass, dns_rdatatype_t type, dns_name_t * rdata_name, dns_rdataset_t ** rdataset, @@ -5804,7 +5804,7 @@ prove_nx_domain(dns_message_t *msg, */ isc_result_t prove_nx_type(dns_message_t *msg, dns_name_t *name, dns_rdataset_t *nsecset, - dns_rdataclass_t class, dns_rdatatype_t type, + dns_rdataclass_t rdclass, dns_rdatatype_t type, dns_name_t *rdata_name, dns_rdataset_t **rdataset, dns_rdataset_t **sigrdataset) { @@ -5812,7 +5812,7 @@ prove_nx_type(dns_message_t *msg, dns_name_t *name, dns_rdataset_t *nsecset, dns_rdataset_t *signsecset; dns_rdata_t nsec = DNS_RDATA_INIT; - UNUSED(class); + UNUSED(rdclass); ret = dns_rdataset_first(nsecset); check_result(ret,"dns_rdataset_first"); @@ -5845,7 +5845,7 @@ prove_nx_type(dns_message_t *msg, dns_name_t *name, dns_rdataset_t *nsecset, * */ isc_result_t -prove_nx(dns_message_t *msg, dns_name_t *name, dns_rdataclass_t class, +prove_nx(dns_message_t *msg, dns_name_t *name, dns_rdataclass_t rdclass, dns_rdatatype_t type, dns_name_t *rdata_name, dns_rdataset_t **rdataset, dns_rdataset_t **sigrdataset) { @@ -5867,7 +5867,7 @@ prove_nx(dns_message_t *msg, dns_name_t *name, dns_rdataclass_t class, DNS_SECTION_AUTHORITY); if (nsecset != NULL) { printf("We have a NSEC for this zone :OK\n"); - ret = prove_nx_type(msg, name, nsecset, class, + ret = prove_nx_type(msg, name, nsecset, rdclass, type, rdata_name, rdataset, sigrdataset); if (ret != ISC_R_SUCCESS) { diff --git a/bin/tests/db/t_db.c b/bin/tests/db/t_db.c index e30932bf43..82ad145cd1 100644 --- a/bin/tests/db/t_db.c +++ b/bin/tests/db/t_db.c @@ -40,7 +40,7 @@ #include static isc_result_t -t_create(const char *db_type, const char *origin, const char *class, +t_create(const char *db_type, const char *origin, const char *classname, const char *model, isc_mem_t *mctx, dns_db_t **db) { int len; @@ -68,8 +68,8 @@ t_create(const char *db_type, const char *origin, const char *class, return(dns_result); } - DE_CONST(class, region.base); - region.length = strlen(class); + DE_CONST(classname, region.base); + region.length = strlen(classname); dns_result = dns_rdataclass_fromtext(&rdataclass, ®ion); if (dns_result != ISC_R_SUCCESS) { t_info("dns_rdataclass_fromtext failed %s\n", @@ -94,7 +94,7 @@ t_dns_db_load(char **av) { char *db_type; char *origin; char *model; - char *class; + char *db_class; char *expected_load_result; char *findname; char *find_type; @@ -125,7 +125,7 @@ t_dns_db_load(char **av) { db_type = T_ARG(1); origin = T_ARG(2); model = T_ARG(3); - class = T_ARG(4); + db_class = T_ARG(4); expected_load_result = T_ARG(5); findname = T_ARG(6); find_type = T_ARG(7); @@ -160,7 +160,7 @@ t_dns_db_load(char **av) { return(T_UNRESOLVED); } - dns_result = t_create(db_type, origin, class, model, mctx, &db); + dns_result = t_create(db_type, origin, db_class, model, mctx, &db); if (dns_result != ISC_R_SUCCESS) { isc_hash_destroy(); isc_entropy_detach(&ectx); @@ -275,7 +275,7 @@ static const char *a2 = "dns_db_iscache(db) returns ISC_TRUE."; static int -t_dns_db_zc_x(char *filename, char *db_type, char *origin, char *class, +t_dns_db_zc_x(char *filename, char *db_type, char *origin, char *db_class, dns_dbtype_t dbtype, isc_boolean_t(*cf)(dns_db_t *), isc_boolean_t exp_result) { @@ -309,8 +309,8 @@ t_dns_db_zc_x(char *filename, char *db_type, char *origin, char *class, return(T_UNRESOLVED); } - textregion.base = class; - textregion.length = strlen(class); + textregion.base = db_class; + textregion.length = strlen(db_class); dns_result = dns_rdataclass_fromtext(&rdataclass, &textregion); if (dns_result != ISC_R_SUCCESS) { t_info("dns_rdataclass_fromtext failed %s\n", @@ -631,7 +631,7 @@ static int t_dns_db_class(char **av) { char *filename; - char *class; + char *db_class; int result; isc_result_t dns_result; @@ -644,16 +644,16 @@ t_dns_db_class(char **av) { isc_textregion_t textregion; filename = T_ARG(0); - class = T_ARG(1); + db_class = T_ARG(1); db = NULL; mctx = NULL; ectx = NULL; t_info("testing with database %s and class %s\n", - filename, class); + filename, db_class); - textregion.base = class; - textregion.length = strlen(class); + textregion.base = db_class; + textregion.length = strlen(db_class); dns_result = dns_rdataclass_fromtext(&rdataclass, &textregion); if (dns_result != ISC_R_SUCCESS) { t_info("dns_rdataclass_fromtext failed %s\n", @@ -685,7 +685,7 @@ t_dns_db_class(char **av) { return(T_UNRESOLVED); } - dns_result = t_create("rbt", ".", class, "isc_true", mctx, &db); + dns_result = t_create("rbt", ".", db_class, "isc_true", mctx, &db); if (dns_result != ISC_R_SUCCESS) { t_info("t_create failed %s\n", dns_result_totext(dns_result)); @@ -714,7 +714,7 @@ t_dns_db_class(char **av) { dns_rdataclass_format(db_rdataclass, classbuf, sizeof(classbuf)); t_info("dns_db_class returned %s, expected %s\n", - classbuf, class); + classbuf, db_class); result = T_FAIL; } @@ -744,7 +744,7 @@ t_dns_db_currentversion(char **av) { char *filename; char *db_type; char *origin; - char *class; + char *db_class; char *model; char *findname; char *findtype; @@ -769,7 +769,7 @@ t_dns_db_currentversion(char **av) { filename = T_ARG(0); db_type = T_ARG(1); origin = T_ARG(2); - class = T_ARG(3); + db_class = T_ARG(3); model = T_ARG(4); findname = T_ARG(5); findtype = T_ARG(6); @@ -803,7 +803,7 @@ t_dns_db_currentversion(char **av) { return(T_UNRESOLVED); } - dns_result = t_create(db_type, origin, class, model, mctx, &db); + dns_result = t_create(db_type, origin, db_class, model, mctx, &db); if (dns_result != ISC_R_SUCCESS) { isc_hash_destroy(); isc_entropy_detach(&ectx); @@ -1016,7 +1016,7 @@ t_dns_db_newversion(char **av) { char *filename; char *db_type; char *origin; - char *class; + char *db_class; char *model; char *newname; char *newtype; @@ -1048,7 +1048,7 @@ t_dns_db_newversion(char **av) { filename = T_ARG(0); db_type = T_ARG(1); origin = T_ARG(2); - class = T_ARG(3); + db_class = T_ARG(3); model = T_ARG(4); newname = T_ARG(5); newtype = T_ARG(6); @@ -1088,7 +1088,7 @@ t_dns_db_newversion(char **av) { return(T_UNRESOLVED); } - dns_result = t_create(db_type, origin, class, model, mctx, &db); + dns_result = t_create(db_type, origin, db_class, model, mctx, &db); if (dns_result != ISC_R_SUCCESS) { isc_hash_destroy(); isc_entropy_detach(&ectx); @@ -1160,8 +1160,8 @@ t_dns_db_newversion(char **av) { return(T_UNRESOLVED); } - textregion.base = class; - textregion.length = strlen(class); + textregion.base = db_class; + textregion.length = strlen(db_class); dns_result = dns_rdataclass_fromtext(&rdataclass, &textregion); if (dns_result != ISC_R_SUCCESS) { t_info("dns_rdataclass_fromtext failed %s\n", @@ -1330,7 +1330,7 @@ t_dns_db_closeversion_1(char **av) { char *filename; char *db_type; char *origin; - char *class; + char *db_class; char *model; char *new_name; char *new_type; @@ -1367,7 +1367,7 @@ t_dns_db_closeversion_1(char **av) { filename = T_ARG(0); db_type = T_ARG(1); origin = T_ARG(2); - class = T_ARG(3); + db_class = T_ARG(3); model = T_ARG(4); new_name = T_ARG(5); new_type = T_ARG(6); @@ -1411,7 +1411,7 @@ t_dns_db_closeversion_1(char **av) { return(T_UNRESOLVED); } - dns_result = t_create(db_type, origin, class, model, mctx, &db); + dns_result = t_create(db_type, origin, db_class, model, mctx, &db); if (dns_result != ISC_R_SUCCESS) { isc_hash_destroy(); isc_entropy_detach(&ectx); @@ -1562,8 +1562,8 @@ t_dns_db_closeversion_1(char **av) { return(T_UNRESOLVED); } - textregion.base = class; - textregion.length = strlen(class); + textregion.base = db_class; + textregion.length = strlen(db_class); dns_result = dns_rdataclass_fromtext(&rdataclass, &textregion); if (dns_result != ISC_R_SUCCESS) { t_info("dns_rdataclass_fromtext failed %s\n", @@ -1739,7 +1739,7 @@ t_dns_db_closeversion_2(char **av) { char *filename; char *db_type; char *origin; - char *class; + char *db_class; char *model; char *new_name; char *new_type; @@ -1776,7 +1776,7 @@ t_dns_db_closeversion_2(char **av) { filename = T_ARG(0); db_type = T_ARG(1); origin = T_ARG(2); - class = T_ARG(3); + db_class = T_ARG(3); model = T_ARG(4); new_name = T_ARG(5); new_type = T_ARG(6); @@ -1820,7 +1820,7 @@ t_dns_db_closeversion_2(char **av) { return(T_UNRESOLVED); } - dns_result = t_create(db_type, origin, class, model, mctx, &db); + dns_result = t_create(db_type, origin, db_class, model, mctx, &db); if (dns_result != ISC_R_SUCCESS) { isc_hash_destroy(); isc_entropy_detach(&ectx); @@ -1968,8 +1968,8 @@ t_dns_db_closeversion_2(char **av) { return(T_UNRESOLVED); } - textregion.base = class; - textregion.length = strlen(class); + textregion.base = db_class; + textregion.length = strlen(db_class); dns_result = dns_rdataclass_fromtext(&rdataclass, &textregion); if (dns_result != ISC_R_SUCCESS) { t_info("dns_rdataclass_fromtext failed %s\n", @@ -2210,7 +2210,7 @@ t_dns_db_expirenode(char **av) { char *filename; char *db_type; char *origin; - char *class; + char *db_class; char *existing_name; char *node_xtime; char *find_xtime; @@ -2236,7 +2236,7 @@ t_dns_db_expirenode(char **av) { filename = T_ARG(0); db_type = T_ARG(1); origin = T_ARG(2); - class = T_ARG(3); + db_class = T_ARG(3); existing_name = T_ARG(4); node_xtime = T_ARG(5); find_xtime = T_ARG(6); @@ -2294,7 +2294,7 @@ t_dns_db_expirenode(char **av) { } db = NULL; - dns_result = t_create(db_type, origin, class, "cache", mctx, &db); + dns_result = t_create(db_type, origin, db_class, "cache", mctx, &db); if (dns_result != ISC_R_SUCCESS) { isc_hash_destroy(); isc_entropy_detach(&ectx); @@ -2413,7 +2413,7 @@ t_dns_db_findnode_1(char **av) { char *filename; char *db_type; char *origin; - char *class; + char *db_class; char *model; char *find_name; char *find_type; @@ -2438,7 +2438,7 @@ t_dns_db_findnode_1(char **av) { filename = T_ARG(0); db_type = T_ARG(1); origin = T_ARG(2); - class = T_ARG(3); + db_class = T_ARG(3); model = T_ARG(4); find_name = T_ARG(5); find_type = T_ARG(6); @@ -2485,7 +2485,7 @@ t_dns_db_findnode_1(char **av) { return(T_UNRESOLVED); } - dns_result = t_create(db_type, origin, class, model, mctx, &db); + dns_result = t_create(db_type, origin, db_class, model, mctx, &db); if (dns_result != ISC_R_SUCCESS) { isc_mem_destroy(&mctx); return(T_UNRESOLVED); @@ -2585,7 +2585,7 @@ t_dns_db_findnode_2(char **av) { char *filename; char *db_type; char *origin; - char *class; + char *db_class; char *model; char *newname; @@ -2608,7 +2608,7 @@ t_dns_db_findnode_2(char **av) { filename = T_ARG(0); db_type = T_ARG(1); origin = T_ARG(2); - class = T_ARG(3); + db_class = T_ARG(3); model = T_ARG(4); newname = T_ARG(5); @@ -2640,7 +2640,7 @@ t_dns_db_findnode_2(char **av) { return(T_UNRESOLVED); } - dns_result = t_create(db_type, origin, class, model, mctx, &db); + dns_result = t_create(db_type, origin, db_class, model, mctx, &db); if (dns_result != ISC_R_SUCCESS) { isc_hash_destroy(); isc_entropy_detach(&ectx); diff --git a/bin/tests/master/t_master.c b/bin/tests/master/t_master.c index 49e6e9ea81..4f082b39cb 100644 --- a/bin/tests/master/t_master.c +++ b/bin/tests/master/t_master.c @@ -63,7 +63,8 @@ t1_add_callback(void *arg, dns_name_t *owner, dns_rdataset_t *dataset) { } static int -test_master(char *testfile, char *origin, char *class, isc_result_t exp_result) +test_master(char *testfile, char *origin, char *db_class, + isc_result_t exp_result) { int result; int len; @@ -103,8 +104,8 @@ test_master(char *testfile, char *origin, char *class, isc_result_t exp_result) dns_rdatacallbacks_init_stdio(&callbacks); callbacks.add = t1_add_callback; - textregion.base = class; - textregion.length = strlen(class); + textregion.base = db_class; + textregion.length = strlen(db_class); dns_result = dns_rdataclass_fromtext(&rdataclass, &textregion); if (dns_result != ISC_R_SUCCESS) { diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index aa0e8d1439..0e2b3ffd54 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -4330,14 +4330,15 @@ same_question(fetchctx_t *fctx) { fctx->res->rdclass != rdataset->rdclass || !dns_name_equal(&fctx->name, name)) { char namebuf[DNS_NAME_FORMATSIZE]; - char class[DNS_RDATACLASS_FORMATSIZE]; - char type[DNS_RDATATYPE_FORMATSIZE]; + char classbuf[DNS_RDATACLASS_FORMATSIZE]; + char typebuf[DNS_RDATATYPE_FORMATSIZE]; dns_name_format(name, namebuf, sizeof(namebuf)); - dns_rdataclass_format(rdataset->rdclass, class, sizeof(class)); - dns_rdatatype_format(rdataset->type, type, sizeof(type)); + dns_rdataclass_format(rdataset->rdclass, classbuf, + sizeof(classbuf)); + dns_rdatatype_format(rdataset->type, typebuf, sizeof(typebuf)); log_formerr(fctx, "question section mismatch: got %s/%s/%s", - namebuf, class, type); + namebuf, classbuf, typebuf); return (DNS_R_FORMERR); } diff --git a/lib/dns/spnego.c b/lib/dns/spnego.c index 6950db21e7..9ec295f90e 100644 --- a/lib/dns/spnego.c +++ b/lib/dns/spnego.c @@ -250,16 +250,16 @@ der_get_oid(const unsigned char *p, size_t len, oid * data, size_t * size); static int der_get_tag(const unsigned char *p, size_t len, - Der_class * class, Der_type * type, + Der_class * xclass, Der_type * type, int *tag, size_t * size); static int der_match_tag(const unsigned char *p, size_t len, - Der_class class, Der_type type, + Der_class xclass, Der_type type, int tag, size_t * size); static int der_match_tag_and_length(const unsigned char *p, size_t len, - Der_class class, Der_type type, int tag, + Der_class xclass, Der_type type, int tag, size_t * length_ret, size_t * size); static int @@ -285,7 +285,7 @@ static int der_put_oid(unsigned char *p, size_t len, const oid * data, size_t * size); static int -der_put_tag(unsigned char *p, size_t len, Der_class class, Der_type type, +der_put_tag(unsigned char *p, size_t len, Der_class xclass, Der_type type, int tag, size_t *); static int der_put_length_and_tag(unsigned char *, size_t, size_t, @@ -909,12 +909,12 @@ der_get_oid(const unsigned char *p, size_t len, static int der_get_tag(const unsigned char *p, size_t len, - Der_class *class, Der_type *type, + Der_class *xclass, Der_type *type, int *tag, size_t *size) { if (len < 1U) return (ASN1_OVERRUN); - *class = (Der_class) (((*p) >> 6) & 0x03); + *xclass = (Der_class) (((*p) >> 6) & 0x03); *type = (Der_type) (((*p) >> 5) & 0x01); *tag = (*p) & 0x1F; if (size) @@ -924,7 +924,7 @@ der_get_tag(const unsigned char *p, size_t len, static int der_match_tag(const unsigned char *p, size_t len, - Der_class class, Der_type type, + Der_class xclass, Der_type type, int tag, size_t *size) { size_t l; @@ -936,7 +936,7 @@ der_match_tag(const unsigned char *p, size_t len, e = der_get_tag(p, len, &thisclass, &thistype, &thistag, &l); if (e) return (e); - if (class != thisclass || type != thistype) + if (xclass != thisclass || type != thistype) return (ASN1_BAD_ID); if (tag > thistag) return (ASN1_MISPLACED_FIELD); @@ -949,13 +949,13 @@ der_match_tag(const unsigned char *p, size_t len, static int der_match_tag_and_length(const unsigned char *p, size_t len, - Der_class class, Der_type type, int tag, + Der_class xclass, Der_type type, int tag, size_t *length_ret, size_t *size) { size_t l, ret = 0; int e; - e = der_match_tag(p, len, class, type, tag, &l); + e = der_match_tag(p, len, xclass, type, tag, &l); if (e) return (e); p += l; @@ -1258,19 +1258,19 @@ der_put_oid(unsigned char *p, size_t len, } static int -der_put_tag(unsigned char *p, size_t len, Der_class class, Der_type type, +der_put_tag(unsigned char *p, size_t len, Der_class xclass, Der_type type, int tag, size_t *size) { if (len < 1U) return (ASN1_OVERFLOW); - *p = (class << 6) | (type << 5) | tag; /* XXX */ + *p = (xclass << 6) | (type << 5) | tag; /* XXX */ *size = 1; return (0); } static int der_put_length_and_tag(unsigned char *p, size_t len, size_t len_val, - Der_class class, Der_type type, int tag, size_t *size) + Der_class xclass, Der_type type, int tag, size_t *size) { size_t ret = 0; size_t l; @@ -1282,7 +1282,7 @@ der_put_length_and_tag(unsigned char *p, size_t len, size_t len_val, p -= l; len -= l; ret += l; - e = der_put_tag(p, len, class, type, tag, &l); + e = der_put_tag(p, len, xclass, type, tag, &l); if (e) return (e); p -= l; diff --git a/lib/tests/include/tests/t_api.h b/lib/tests/include/tests/t_api.h index 40675bdce4..e6cb649ca7 100644 --- a/lib/tests/include/tests/t_api.h +++ b/lib/tests/include/tests/t_api.h @@ -82,7 +82,7 @@ t_main(int argc, char **argv); #endif void -t_assert(const char *component, int anum, int class, const char *what, ...) +t_assert(const char *component, int anum, int tclass, const char *what, ...) ISC_FORMAT_PRINTF(4, 5); void diff --git a/lib/tests/t_api.c b/lib/tests/t_api.c index c84d7d2723..9dd32e9702 100644 --- a/lib/tests/t_api.c +++ b/lib/tests/t_api.c @@ -368,11 +368,11 @@ t_main(int argc, char **argv) } void -t_assert(const char *component, int anum, int class, const char *what, ...) { +t_assert(const char *component, int anum, int tclass, const char *what, ...) { va_list args; char buf[T_BIGBUF]; - (void)printf("T:%s:%d:%s\n", component, anum, class == T_REQUIRED ? + (void)printf("T:%s:%d:%s\n", component, anum, tclass == T_REQUIRED ? "A" : "C"); /*