Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/bind/dist/lib/dns - Relax some of the assertion...



details:   https://anonhg.NetBSD.org/src/rev/c21726635b97
branches:  trunk
changeset: 785668:c21726635b97
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 24 18:43:32 2013 +0000

description:
- Relax some of the assertions to make things work outside bind.
- Remove #ifndef BIND9 exclusions
Now a libdns that is built with BIND9 can be used by other isc programs.

diffstat:

 external/bsd/bind/dist/lib/dns/dst_api.c |   9 +++------
 external/bsd/bind/dist/lib/dns/ecdb.c    |  20 ++++++++++++--------
 external/bsd/bind/dist/lib/dns/lib.c     |  10 +---------
 3 files changed, 16 insertions(+), 23 deletions(-)

diffs (122 lines):

diff -r 7623f7905b76 -r c21726635b97 external/bsd/bind/dist/lib/dns/dst_api.c
--- a/external/bsd/bind/dist/lib/dns/dst_api.c  Sun Mar 24 18:41:59 2013 +0000
+++ b/external/bsd/bind/dist/lib/dns/dst_api.c  Sun Mar 24 18:43:32 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dst_api.c,v 1.5 2012/12/04 23:38:42 spz Exp $  */
+/*     $NetBSD: dst_api.c,v 1.6 2013/03/24 18:43:32 christos Exp $     */
 
 /*
  * Portions Copyright (C) 2004-2012  Internet Systems Consortium, Inc. ("ISC")
@@ -164,11 +164,7 @@
        isc_result_t result;
 
        REQUIRE(mctx != NULL);
-#ifdef BIND9
-       REQUIRE(ectx != NULL);
-#else
        UNUSED(ectx);
-#endif
        REQUIRE(dst_initialized == ISC_FALSE);
 
 #ifndef OPENSSL
@@ -199,7 +195,8 @@
        isc_mem_attach(mctx, &dst__memory_pool);
 #endif
 #ifdef BIND9
-       isc_entropy_attach(ectx, &dst_entropy_pool);
+       if (ectx)
+               isc_entropy_attach(ectx, &dst_entropy_pool);
 #endif
        dst_entropy_flags = eflags;
 
diff -r 7623f7905b76 -r c21726635b97 external/bsd/bind/dist/lib/dns/ecdb.c
--- a/external/bsd/bind/dist/lib/dns/ecdb.c     Sun Mar 24 18:41:59 2013 +0000
+++ b/external/bsd/bind/dist/lib/dns/ecdb.c     Sun Mar 24 18:43:32 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ecdb.c,v 1.3 2012/06/05 00:41:31 christos Exp $        */
+/*     $NetBSD: ecdb.c,v 1.4 2013/03/24 18:43:32 christos Exp $        */
 
 /*
  * Copyright (C) 2009-2011  Internet Systems Consortium, Inc. ("ISC")
@@ -767,19 +767,23 @@
 
 static void
 rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp) {
-       ecdb_rdatasetiter_t *ecdbiterator;
+       union {
+               dns_rdatasetiter_t *rdatasetiterator;
+               ecdb_rdatasetiter_t *ecdbiterator;
+       } u;
        isc_mem_t *mctx;
 
        REQUIRE(iteratorp != NULL);
-       ecdbiterator = (ecdb_rdatasetiter_t *)*iteratorp;
-       REQUIRE(DNS_RDATASETITER_VALID(&ecdbiterator->common));
+       u.rdatasetiterator = *iteratorp;
+//     REQUIRE(DNS_RDATASETITER_VALID(&(u.ecdbiterator->common)));
 
-       mctx = ecdbiterator->common.db->mctx;
+       mctx = u.ecdbiterator->common.db->mctx;
 
-       ecdbiterator->common.magic = 0;
+       u.ecdbiterator->common.magic = 0;
 
-       dns_db_detachnode(ecdbiterator->common.db, &ecdbiterator->common.node);
-       isc_mem_put(mctx, ecdbiterator, sizeof(ecdb_rdatasetiter_t));
+       dns_db_detachnode(u.ecdbiterator->common.db,
+           &u.ecdbiterator->common.node);
+       isc_mem_put(mctx, u.ecdbiterator, sizeof(ecdb_rdatasetiter_t));
 
        *iteratorp = NULL;
 }
diff -r 7623f7905b76 -r c21726635b97 external/bsd/bind/dist/lib/dns/lib.c
--- a/external/bsd/bind/dist/lib/dns/lib.c      Sun Mar 24 18:41:59 2013 +0000
+++ b/external/bsd/bind/dist/lib/dns/lib.c      Sun Mar 24 18:43:32 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lib.c,v 1.3 2012/06/05 00:41:33 christos Exp $ */
+/*     $NetBSD: lib.c,v 1.4 2013/03/24 18:43:32 christos Exp $ */
 
 /*
  * Copyright (C) 2004, 2005, 2007, 2009  Internet Systems Consortium, Inc. ("ISC")
@@ -77,9 +77,7 @@
 
 static isc_once_t init_once = ISC_ONCE_INIT;
 static isc_mem_t *dns_g_mctx = NULL;
-#ifndef BIND9
 static dns_dbimplementation_t *dbimp = NULL;
-#endif
 static isc_boolean_t initialize_done = ISC_FALSE;
 static isc_mutex_t reflock;
 static unsigned int references = 0;
@@ -94,11 +92,9 @@
        if (result != ISC_R_SUCCESS)
                return;
        dns_result_register();
-#ifndef BIND9
        result = dns_ecdb_register(dns_g_mctx, &dbimp);
        if (result != ISC_R_SUCCESS)
                goto cleanup_mctx;
-#endif
        result = isc_hash_create(dns_g_mctx, NULL, DNS_NAME_MAXWIRE);
        if (result != ISC_R_SUCCESS)
                goto cleanup_db;
@@ -119,10 +115,8 @@
   cleanup_hash:
        isc_hash_destroy();
   cleanup_db:
-#ifndef BIND9
        dns_ecdb_unregister(&dbimp);
   cleanup_mctx:
-#endif
        isc_mem_detach(&dns_g_mctx);
 }
 
@@ -163,8 +157,6 @@
 
        dst_lib_destroy();
        isc_hash_destroy();
-#ifndef BIND9
        dns_ecdb_unregister(&dbimp);
-#endif
        isc_mem_detach(&dns_g_mctx);
 }



Home | Main Index | Thread Index | Old Index