mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Enforce type checking for dns_dbnode_t
Originally, the dns_dbnode_t was typedef'ed to void type. This allowed some flexibility, but using (void *) just removes any type-checking that C might have. Instead of using: typedef void dns_dbnode_t; use a trick to define the type to non-existing structure: typedef struct dns_dbnode dns_dbnode_t; This allows the C compilers to employ the type-checking while the structure itself doesn't have to be ever defined because the actual 'storage' is never accessed using dns_dbnode_t type.
This commit is contained in:
@@ -606,7 +606,7 @@ getnodedata(dns_db_t *db, const dns_name_t *name, bool create,
|
||||
dns_name_dup(name, sdlz->common.mctx, node->name);
|
||||
}
|
||||
|
||||
*nodep = node;
|
||||
*nodep = (dns_dbnode_t *)node;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -1271,7 +1271,8 @@ dbiterator_current(dns_dbiterator_t *iterator, dns_dbnode_t **nodep,
|
||||
dns_name_t *name DNS__DB_FLARG) {
|
||||
sdlz_dbiterator_t *sdlziter = (sdlz_dbiterator_t *)iterator;
|
||||
|
||||
attachnode(iterator->db, sdlziter->current, nodep DNS__DB_FLARG_PASS);
|
||||
attachnode(iterator->db, (dns_dbnode_t *)sdlziter->current,
|
||||
nodep DNS__DB_FLARG_PASS);
|
||||
if (name != NULL) {
|
||||
dns_name_copy(sdlziter->current->name, name);
|
||||
return (ISC_R_SUCCESS);
|
||||
|
Reference in New Issue
Block a user