]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3437. [bug] isc_buffer_init -> isc_buffer_constinit to initialise
authorMark Andrews <marka@isc.org>
Sat, 8 Dec 2012 01:48:57 +0000 (12:48 +1100)
committerMark Andrews <marka@isc.org>
Sat, 8 Dec 2012 01:48:57 +0000 (12:48 +1100)
                        buffers with constant data. [RT #32064]

Squashed commit of the following:

commit 3433b96bf11f8c90ccbe412f01d02a6d8bbc2d33
Author: Mark Andrews <marka@isc.org>
Date:   Sat Dec 8 12:41:16 2012 +1100

    isc_buffer_init -> isc_buffer_constinit

commit c22dbcc1122a0a44f7b46068e0ccbc25353a57d5
Author: Mark Andrews <marka@isc.org>
Date:   Sat Dec 8 12:38:39 2012 +1100

    isc_buffer_init -> isc_buffer_constinit

commit 900820416c45c1887d0d22d7a010df60a903bd56
Author: Mark Andrews <marka@isc.org>
Date:   Sat Dec 8 12:24:19 2012 +1100

    remove isc_buffer_reconstinit

commit f815711c17b05f9961786a90b9bae902d3c01494
Author: Mark Andrews <marka@isc.org>
Date:   Wed Dec 5 15:42:57 2012 +1100

    add isc_buffer_constinit

29 files changed:
CHANGES
bin/check/check-tool.c
bin/named/config.c
bin/named/lwresd.c
bin/named/server.c
bin/named/tkeyconf.c
bin/named/tsigconf.c
bin/named/zoneconf.c
bin/tests/db/t_db.c
bin/tests/dst/dst_test.c
bin/tests/dst/t_dst.c
bin/tests/system/rsabigexponent/bigkey.c
bin/tests/system/tkey/keycreate.c
contrib/dlz/drivers/sdlz_helper.c
lib/bind9/check.c
lib/dns/dlz.c
lib/dns/name.c
lib/dns/peer.c
lib/dns/sdb.c
lib/dns/sdlz.c
lib/dns/tests/dbiterator_test.c
lib/dns/tests/dnstest.c
lib/export/samples/sample-request.c
lib/export/samples/sample.c
lib/irs/dnsconf.c
lib/irs/getaddrinfo.c
lib/isc/buffer.c
lib/isc/include/isc/buffer.h
lib/isccfg/aclconf.c

diff --git a/CHANGES b/CHANGES
index b2432938a6ebbea9c04fba054c92f3a8ad14c4b9..3a249bc05bc16a6147de53de23879e8c1d3fd5d8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3437.  [bug]           isc_buffer_init -> isc_buffer_constinit to initialise
+                       buffers with constant data. [RT #32064]
+
 3436.  [bug]           Check malloc/calloc return values. [RT #32088]
 
 3435.  [bug]           Cross compilation support in configure was broken.
index 436fa683d1b79d536111d84a4106abc4893e336d..1e534071d0c80fa6361b118291fb47cc6e069e62 100644 (file)
@@ -600,7 +600,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
 
        dns_zone_settype(zone, dns_zone_master);
 
-       isc_buffer_init(&buffer, zonename, strlen(zonename));
+       isc_buffer_constinit(&buffer, zonename, strlen(zonename));
        isc_buffer_add(&buffer, strlen(zonename));
        dns_fixedname_init(&fixorigin);
        origin = dns_fixedname_name(&fixorigin);
index eaba42b18aeea456619690a1142f447d95fc6081..1d15dde238a42fd48b645b85e58eb57024c1da8b 100644 (file)
@@ -658,7 +658,7 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
                dns_name_init(keys[i - 1], NULL);
 
                keystr = cfg_obj_asstring(key);
-               isc_buffer_init(&b, keystr, strlen(keystr));
+               isc_buffer_constinit(&b, keystr, strlen(keystr));
                isc_buffer_add(&b, strlen(keystr));
                dns_fixedname_init(&fname);
                result = dns_name_fromtext(dns_fixedname_name(&fname), &b,
index 11198a4324f2c2b4f843df3f3427f6dde1a1b873..e4f90bc790b3a73f795c58729fb54246687ef947 100644 (file)
@@ -368,7 +368,7 @@ ns_lwdmanager_create(isc_mem_t *mctx, const cfg_obj_t *lwres,
 
                        dns_fixedname_init(&fname);
                        name = dns_fixedname_name(&fname);
-                       isc_buffer_init(&namebuf, searchstr,
+                       isc_buffer_constinit(&namebuf, searchstr,
                                        strlen(searchstr));
                        isc_buffer_add(&namebuf, strlen(searchstr));
                        result = dns_name_fromtext(name, &namebuf,
index c84251781d487c557480bf06ba8a3ebf56be2811..dcf0cbee903372375750f54c9569587e11763383 100644 (file)
@@ -523,7 +523,7 @@ configure_view_nametable(const cfg_obj_t *vconfig, const cfg_obj_t *config,
             element = cfg_list_next(element)) {
                nameobj = cfg_listelt_value(element);
                str = cfg_obj_asstring(nameobj);
-               isc_buffer_init(&b, str, strlen(str));
+               isc_buffer_constinit(&b, str, strlen(str));
                isc_buffer_add(&b, strlen(str));
                CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
                /*
@@ -640,7 +640,7 @@ dstkey_fromconfig(const cfg_obj_t *vconfig, const cfg_obj_t *key,
                                   keystruct.common.rdtype,
                                   &keystruct, &rrdatabuf));
        dns_fixedname_init(&fkeyname);
-       isc_buffer_init(&namebuf, keynamestr, strlen(keynamestr));
+       isc_buffer_constinit(&namebuf, keynamestr, strlen(keynamestr));
        isc_buffer_add(&namebuf, strlen(keynamestr));
        CHECK(dns_name_fromtext(keyname, &namebuf, dns_rootname, 0, NULL));
        CHECK(dst_key_fromdns(keyname, viewclass, &rrdatabuf,
@@ -910,7 +910,7 @@ mustbesecure(const cfg_obj_t *mbs, dns_resolver_t *resolver) {
        {
                obj = cfg_listelt_value(element);
                str = cfg_obj_asstring(cfg_tuple_get(obj, "name"));
-               isc_buffer_init(&b, str, strlen(str));
+               isc_buffer_constinit(&b, str, strlen(str));
                isc_buffer_add(&b, strlen(str));
                CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
                value = cfg_obj_asboolean(cfg_tuple_get(obj, "value"));
@@ -1063,7 +1063,7 @@ configure_order(dns_order_t *order, const cfg_obj_t *ent) {
        else
                str = "*";
        addroot = ISC_TF(strcmp(str, "*") == 0);
-       isc_buffer_init(&b, str, strlen(str));
+       isc_buffer_constinit(&b, str, strlen(str));
        isc_buffer_add(&b, strlen(str));
        dns_fixedname_init(&fixed);
        result = dns_name_fromtext(dns_fixedname_name(&fixed), &b,
@@ -1249,7 +1249,7 @@ disable_algorithms(const cfg_obj_t *disabled, dns_resolver_t *resolver) {
        dns_fixedname_init(&fixed);
        name = dns_fixedname_name(&fixed);
        str = cfg_obj_asstring(cfg_tuple_get(disabled, "name"));
-       isc_buffer_init(&b, str, strlen(str));
+       isc_buffer_constinit(&b, str, strlen(str));
        isc_buffer_add(&b, strlen(str));
        CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
 
@@ -1295,7 +1295,7 @@ disable_ds_digests(const cfg_obj_t *disabled, dns_resolver_t *resolver) {
        dns_fixedname_init(&fixed);
        name = dns_fixedname_name(&fixed);
        str = cfg_obj_asstring(cfg_tuple_get(disabled, "name"));
-       isc_buffer_init(&b, str, strlen(str));
+       isc_buffer_constinit(&b, str, strlen(str));
        isc_buffer_add(&b, strlen(str));
        CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
 
@@ -1343,7 +1343,7 @@ on_disable_list(const cfg_obj_t *disablelist, dns_name_t *zonename) {
        {
                value = cfg_listelt_value(element);
                str = cfg_obj_asstring(value);
-               isc_buffer_init(&b, str, strlen(str));
+               isc_buffer_constinit(&b, str, strlen(str));
                isc_buffer_add(&b, strlen(str));
                result = dns_name_fromtext(name, &b, dns_rootname,
                                           0, NULL);
@@ -1526,7 +1526,7 @@ dns64_reverse(dns_view_t *view, isc_mem_t *mctx, isc_netaddr_t *na,
                dns64_dbtype[3] = contact;
        dns_fixedname_init(&fixed);
        name = dns_fixedname_name(&fixed);
-       isc_buffer_init(&b, reverse, strlen(reverse));
+       isc_buffer_constinit(&b, reverse, strlen(reverse));
        isc_buffer_add(&b, strlen(reverse));
        CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
        CHECK(dns_zone_create(&zone, mctx));
@@ -2830,7 +2830,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
                        obj = cfg_listelt_value(element);
                        str = cfg_obj_asstring(cfg_tuple_get(obj,
                                                             "trust-anchor"));
-                       isc_buffer_init(&b, str, strlen(str));
+                       isc_buffer_constinit(&b, str, strlen(str));
                        isc_buffer_add(&b, strlen(str));
                        dlv = dns_fixedname_name(&view->dlv_fixed);
                        CHECK(dns_name_fromtext(dlv, &b, dns_rootname,
@@ -2883,7 +2883,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
                             element = cfg_list_next(element)) {
                                exclude = cfg_listelt_value(element);
                                str = cfg_obj_asstring(exclude);
-                               isc_buffer_init(&b, str, strlen(str));
+                               isc_buffer_constinit(&b, str, strlen(str));
                                isc_buffer_add(&b, strlen(str));
                                CHECK(dns_name_fromtext(name, &b, dns_rootname,
                                                        0, NULL));
@@ -2933,7 +2933,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
                result = ns_config_get(maps, "empty-server", &obj);
                if (result == ISC_R_SUCCESS) {
                        str = cfg_obj_asstring(obj);
-                       isc_buffer_init(&buffer, str, strlen(str));
+                       isc_buffer_constinit(&buffer, str, strlen(str));
                        isc_buffer_add(&buffer, strlen(str));
                        CHECK(dns_name_fromtext(name, &buffer, dns_rootname, 0,
                                                NULL));
@@ -2948,7 +2948,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
                result = ns_config_get(maps, "empty-contact", &obj);
                if (result == ISC_R_SUCCESS) {
                        str = cfg_obj_asstring(obj);
-                       isc_buffer_init(&buffer, str, strlen(str));
+                       isc_buffer_constinit(&buffer, str, strlen(str));
                        isc_buffer_add(&buffer, strlen(str));
                        CHECK(dns_name_fromtext(name, &buffer, dns_rootname, 0,
                                                NULL));
@@ -2971,7 +2971,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
                        dns_forwarders_t *forwarders = NULL;
                        dns_view_t *pview = NULL;
 
-                       isc_buffer_init(&buffer, empty, strlen(empty));
+                       isc_buffer_constinit(&buffer, empty, strlen(empty));
                        isc_buffer_add(&buffer, strlen(empty));
                        /*
                         * Look for zone on drop list.
@@ -3198,7 +3198,7 @@ configure_alternates(const cfg_obj_t *config, dns_view_t *view,
                        isc_buffer_t buffer;
                        in_port_t myport = port;
 
-                       isc_buffer_init(&buffer, str, strlen(str));
+                       isc_buffer_constinit(&buffer, str, strlen(str));
                        isc_buffer_add(&buffer, strlen(str));
                        dns_fixedname_init(&fixed);
                        name = dns_fixedname_name(&fixed);
@@ -3462,7 +3462,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
         * Get the zone origin as a dns_name_t.
         */
        zname = cfg_obj_asstring(cfg_tuple_get(zconfig, "name"));
-       isc_buffer_init(&buffer, zname, strlen(zname));
+       isc_buffer_constinit(&buffer, zname, strlen(zname));
        isc_buffer_add(&buffer, strlen(zname));
        dns_fixedname_init(&fixorigin);
        CHECK(dns_name_fromtext(dns_fixedname_name(&fixorigin),
@@ -4352,7 +4352,7 @@ configure_session_key(const cfg_obj_t **maps, ns_server_t *server,
        INSIST(result == ISC_R_SUCCESS);
        keynamestr = cfg_obj_asstring(obj);
        dns_fixedname_init(&fname);
-       isc_buffer_init(&buffer, keynamestr, strlen(keynamestr));
+       isc_buffer_constinit(&buffer, keynamestr, strlen(keynamestr));
        isc_buffer_add(&buffer, strlen(keynamestr));
        keyname = dns_fixedname_name(&fname);
        result = dns_name_fromtext(keyname, &buffer, dns_rootname, 0, NULL);
@@ -6177,7 +6177,7 @@ zone_from_args(ns_server_t *server, char *args, const char *zonetxt,
                viewtxt = next_token(&input, " \t");
        }
 
-       isc_buffer_init(&buf, zonetxt, strlen(zonetxt));
+       isc_buffer_constinit(&buf, zonetxt, strlen(zonetxt));
        isc_buffer_add(&buf, strlen(zonetxt));
        dns_fixedname_init(&name);
        result = dns_name_fromtext(dns_fixedname_name(&name),
@@ -7114,7 +7114,7 @@ ns_server_flushnode(ns_server_t *server, char *args, isc_boolean_t tree) {
        if (target == NULL)
                return (ISC_R_UNEXPECTEDEND);
 
-       isc_buffer_init(&b, target, strlen(target));
+       isc_buffer_constinit(&b, target, strlen(target));
        isc_buffer_add(&b, strlen(target));
        dns_fixedname_init(&fixed);
        name = dns_fixedname_name(&fixed);
@@ -7787,7 +7787,7 @@ ns_server_add_zone(ns_server_t *server, char *args) {
        CHECK(cfg_map_get(config, "addzone", &parms));
 
        zonename = cfg_obj_asstring(cfg_tuple_get(parms, "name"));
-       isc_buffer_init(&buf, zonename, strlen(zonename));
+       isc_buffer_constinit(&buf, zonename, strlen(zonename));
        isc_buffer_add(&buf, strlen(zonename));
        dns_name_init(&dnsname, NULL);
        isc_buffer_allocate(server->mctx, &nbuf, 256);
index 6d852a0871c0930c407d352bee6f8d837a5f3767..f38d9420ba84a2cdbc57e5f448ee021bb1fd83c0 100644 (file)
@@ -73,7 +73,7 @@ ns_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
        if (result == ISC_R_SUCCESS) {
                s = cfg_obj_asstring(cfg_tuple_get(obj, "name"));
                n = cfg_obj_asuint32(cfg_tuple_get(obj, "keyid"));
-               isc_buffer_init(&b, s, strlen(s));
+               isc_buffer_constinit(&b, s, strlen(s));
                isc_buffer_add(&b, strlen(s));
                dns_fixedname_init(&fname);
                name = dns_fixedname_name(&fname);
@@ -87,7 +87,7 @@ ns_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
        result = cfg_map_get(options, "tkey-domain", &obj);
        if (result == ISC_R_SUCCESS) {
                s = cfg_obj_asstring(obj);
-               isc_buffer_init(&b, s, strlen(s));
+               isc_buffer_constinit(&b, s, strlen(s));
                isc_buffer_add(&b, strlen(s));
                dns_fixedname_init(&fname);
                name = dns_fixedname_name(&fname);
@@ -106,7 +106,7 @@ ns_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
        if (result == ISC_R_SUCCESS) {
                s = cfg_obj_asstring(obj);
 
-               isc_buffer_init(&b, s, strlen(s));
+               isc_buffer_constinit(&b, s, strlen(s));
                isc_buffer_add(&b, strlen(s));
                dns_fixedname_init(&fname);
                name = dns_fixedname_name(&fname);
index 776b1b9f837dd2fe1576b1d2d8499129bccda366..5f9135d4d2f2b638216798c1ed7b0497788f2070 100644 (file)
@@ -78,7 +78,7 @@ add_initial_keys(const cfg_obj_t *list, dns_tsig_keyring_t *ring,
                 * Create the key name.
                 */
                dns_name_init(&keyname, NULL);
-               isc_buffer_init(&keynamesrc, keyid, strlen(keyid));
+               isc_buffer_constinit(&keynamesrc, keyid, strlen(keyid));
                isc_buffer_add(&keynamesrc, strlen(keyid));
                isc_buffer_init(&keynamebuf, keynamedata, sizeof(keynamedata));
                ret = dns_name_fromtext(&keyname, &keynamesrc, dns_rootname,
index 6438bb3dd3fb2d38fc8e03e1b941fbd85d69bb34..fff75d21076625028c7d952179693aa4f9e00520 100644 (file)
@@ -269,7 +269,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
 
                dns_fixedname_init(&fident);
                str = cfg_obj_asstring(identity);
-               isc_buffer_init(&b, str, strlen(str));
+               isc_buffer_constinit(&b, str, strlen(str));
                isc_buffer_add(&b, strlen(str));
                result = dns_name_fromtext(dns_fixedname_name(&fident), &b,
                                           dns_rootname, 0, NULL);
@@ -292,7 +292,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
                        }
                } else {
                        str = cfg_obj_asstring(dname);
-                       isc_buffer_init(&b, str, strlen(str));
+                       isc_buffer_constinit(&b, str, strlen(str));
                        isc_buffer_add(&b, strlen(str));
                        result = dns_name_fromtext(dns_fixedname_name(&fname),
                                                   &b, dns_rootname, 0, NULL);
@@ -525,7 +525,7 @@ configure_staticstub_servernames(const cfg_obj_t *zconfig, dns_zone_t *zone,
                dns_fixedname_init(&fixed_name);
                nsname = dns_fixedname_name(&fixed_name);
 
-               isc_buffer_init(&b, str, strlen(str));
+               isc_buffer_constinit(&b, str, strlen(str));
                isc_buffer_add(&b, strlen(str));
                result = dns_name_fromtext(nsname, &b, dns_rootname, 0, NULL);
                if (result != ISC_R_SUCCESS) {
index 54ef5a647d216a5706287ae8842df710860c3483..37e67bacde330575914bfdc59ae9a6c13a9d3903 100644 (file)
@@ -58,7 +58,7 @@ t_create(const char *db_type, const char *origin, const char *class,
 
        dns_fixedname_init(&dns_origin);
        len = strlen(origin);
-       isc_buffer_init(&origin_buffer, origin, len);
+       isc_buffer_constinit(&origin_buffer, origin, len);
        isc_buffer_add(&origin_buffer, len);
        dns_result = dns_name_fromtext(dns_fixedname_name(&dns_origin),
                                       &origin_buffer, NULL, 0, NULL);
index ac1327c99f6e866a331fbd1c2ec24cdad74ab6fe..ecea7b829cf5eb5f98367b9b0b3bdeaf6b1e8e60 100644 (file)
@@ -54,7 +54,7 @@ use(dst_key_t *key, isc_mem_t *mctx) {
         */
        isc_buffer_add(&sigbuf, 1);
 
-       isc_buffer_init(&databuf, data, strlen(data));
+       isc_buffer_constinit(&databuf, data, strlen(data));
        isc_buffer_add(&databuf, strlen(data));
        isc_buffer_usedregion(&databuf, &datareg);
 
@@ -262,7 +262,7 @@ main(void) {
 
        dns_fixedname_init(&fname);
        name = dns_fixedname_name(&fname);
-       isc_buffer_init(&b, "test.", 5);
+       isc_buffer_constinit(&b, "test.", 5);
        isc_buffer_add(&b, 5);
        result = dns_name_fromtext(name, &b, NULL, 0, NULL);
        if (result != ISC_R_SUCCESS)
@@ -274,7 +274,7 @@ main(void) {
        io(name, 49667, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
        io(name, 2, DST_ALG_RSAMD5, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
 
-       isc_buffer_init(&b, "dh.", 3);
+       isc_buffer_constinit(&b, "dh.", 3);
        isc_buffer_add(&b, 3);
        result = dns_name_fromtext(name, &b, NULL, 0, NULL);
        if (result != ISC_R_SUCCESS)
index 75a2a40ff1127e658434700f6337fbc5e9dc4321..e431c951bb068afc3127904b989feed193e8789b 100644 (file)
@@ -104,7 +104,7 @@ use(dst_key_t *key, isc_mem_t *mctx, isc_result_t exp_result, int *nfails) {
        dst_context_t *ctx = NULL;
 
        isc_buffer_init(&sigbuf, sig, sizeof(sig));
-       isc_buffer_init(&databuf, data, strlen(data));
+       isc_buffer_constinit(&databuf, data, strlen(data));
        isc_buffer_add(&databuf, strlen(data));
        isc_buffer_usedregion(&databuf, &datareg);
 
@@ -466,7 +466,7 @@ t1(void) {
 
        dns_fixedname_init(&fname);
        name = dns_fixedname_name(&fname);
-       isc_buffer_init(&b, "test.", 5);
+       isc_buffer_constinit(&b, "test.", 5);
        isc_buffer_add(&b, 5);
        isc_result = dns_name_fromtext(name, &b, NULL, 0, NULL);
        if (isc_result != ISC_R_SUCCESS) {
@@ -488,7 +488,7 @@ t1(void) {
        io(name, 2, DST_ALG_RSAMD5, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
                        mctx, DST_R_NULLKEY, &nfails, &nprobs);
 
-       isc_buffer_init(&b, "dh.", 3);
+       isc_buffer_constinit(&b, "dh.", 3);
        isc_buffer_add(&b, 3);
        isc_result = dns_name_fromtext(name, &b, NULL, 0, NULL);
        if (isc_result != ISC_R_SUCCESS) {
@@ -750,7 +750,7 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname,
         */
        dns_fixedname_init(&fname);
        name = dns_fixedname_name(&fname);
-       isc_buffer_init(&b, keyname, strlen(keyname));
+       isc_buffer_constinit(&b, keyname, strlen(keyname));
        isc_buffer_add(&b, strlen(keyname));
        isc_result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
        if (isc_result != ISC_R_SUCCESS) {
index 9136a330cbeaba12d29b6185d2f3337c6114a0e9..b8984267e5f1647379a07d729f888e8e43fc7aef 100644 (file)
@@ -202,7 +202,7 @@ main(int argc, char **argv) {
              "isc_log_usechannel()");
        dns_fixedname_init(&fname);
        name = dns_fixedname_name(&fname);
-       isc_buffer_init(&buf, "example.", strlen("example."));
+       isc_buffer_constinit(&buf, "example.", strlen("example."));
        isc_buffer_add(&buf, strlen("example."));
        CHECK(dns_name_fromtext(name, &buf, dns_rootname, 0, NULL),
              "dns_name_fromtext(\"example.\")");
index a417a91b23b2b2b739b88ab42ad4e16a2a6d132f..b1f3f34235e46e1e25c82318fa1fc581f91d0f20 100644 (file)
@@ -150,14 +150,14 @@ sendquery(isc_task_t *task, isc_event_t *event) {
        isc_sockaddr_fromin(&address, &inaddr, PORT);
 
        dns_fixedname_init(&keyname);
-       isc_buffer_init(&namestr, "tkeytest.", 9);
+       isc_buffer_constinit(&namestr, "tkeytest.", 9);
        isc_buffer_add(&namestr, 9);
        result = dns_name_fromtext(dns_fixedname_name(&keyname), &namestr,
                                   NULL, 0, NULL);
        CHECK("dns_name_fromtext", result);
 
        dns_fixedname_init(&ownername);
-       isc_buffer_init(&namestr, ownername_str, strlen(ownername_str));
+       isc_buffer_constinit(&namestr, ownername_str, strlen(ownername_str));
        isc_buffer_add(&namestr, strlen(ownername_str));
        result = dns_name_fromtext(dns_fixedname_name(&ownername), &namestr,
                                   NULL, 0, NULL);
index 85ad3b1c75181a2bc4784229241b67c04e4b3414..76dee7e36c89762e900cba5ca196e930e4cd8980 100644 (file)
@@ -481,7 +481,7 @@ sdlzh_destroy_sqldbinstance(dbinstance_t *dbi)
        destroy_querylist(mctx, &dbi->lookup_q);
 
        /* get rid of the mutex */
-       isc_mutex_destroy(&dbi->instance_lock);
+       (void) isc_mutex_destroy(&dbi->instance_lock);
 
        /* return, and detach the memory */
        isc_mem_put(mctx, dbi, sizeof(dbinstance_t));
index 66fd3d248052c254b187f3935178d0f2b3ec844a..413686801fc8d8e009d07e287bdad8b35f9fb189 100644 (file)
@@ -100,7 +100,7 @@ check_orderent(const cfg_obj_t *ent, isc_log_t *logctx) {
        obj = cfg_tuple_get(ent, "name");
        if (cfg_obj_isstring(obj)) {
                str = cfg_obj_asstring(obj);
-               isc_buffer_init(&b, str, strlen(str));
+               isc_buffer_constinit(&b, str, strlen(str));
                isc_buffer_add(&b, strlen(str));
                tresult = dns_name_fromtext(dns_fixedname_name(&fixed), &b,
                                            dns_rootname, 0, NULL);
@@ -197,7 +197,7 @@ check_dual_stack(const cfg_obj_t *options, isc_log_t *logctx) {
                        continue;
                obj = cfg_tuple_get(value, "name");
                str = cfg_obj_asstring(obj);
-               isc_buffer_init(&buffer, str, strlen(str));
+               isc_buffer_constinit(&buffer, str, strlen(str));
                isc_buffer_add(&buffer, strlen(str));
                dns_fixedname_init(&fixed);
                name = dns_fixedname_name(&fixed);
@@ -263,7 +263,7 @@ disabled_algorithms(const cfg_obj_t *disabled, isc_log_t *logctx) {
        name = dns_fixedname_name(&fixed);
        obj = cfg_tuple_get(disabled, "name");
        str = cfg_obj_asstring(obj);
-       isc_buffer_init(&b, str, strlen(str));
+       isc_buffer_constinit(&b, str, strlen(str));
        isc_buffer_add(&b, strlen(str));
        tresult = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
        if (tresult != ISC_R_SUCCESS) {
@@ -311,7 +311,7 @@ disabled_ds_digests(const cfg_obj_t *disabled, isc_log_t *logctx) {
        name = dns_fixedname_name(&fixed);
        obj = cfg_tuple_get(disabled, "name");
        str = cfg_obj_asstring(obj);
-       isc_buffer_init(&b, str, strlen(str));
+       isc_buffer_constinit(&b, str, strlen(str));
        isc_buffer_add(&b, strlen(str));
        tresult = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
        if (tresult != ISC_R_SUCCESS) {
@@ -395,7 +395,7 @@ mustbesecure(const cfg_obj_t *secure, isc_symtab_t *symtab, isc_log_t *logctx,
        name = dns_fixedname_name(&fixed);
        obj = cfg_tuple_get(secure, "name");
        str = cfg_obj_asstring(obj);
-       isc_buffer_init(&b, str, strlen(str));
+       isc_buffer_constinit(&b, str, strlen(str));
        isc_buffer_add(&b, strlen(str));
        result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
        if (result != ISC_R_SUCCESS) {
@@ -886,7 +886,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx,
                             element = cfg_list_next(element)) {
                                exclude = cfg_listelt_value(element);
                                str = cfg_obj_asstring(exclude);
-                               isc_buffer_init(&b, str, strlen(str));
+                               isc_buffer_constinit(&b, str, strlen(str));
                                isc_buffer_add(&b, strlen(str));
                                tresult = dns_name_fromtext(name, &b,
                                                           dns_rootname,
@@ -971,7 +971,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx,
                                        continue;
                        }
 
-                       isc_buffer_init(&b, dlv, strlen(dlv));
+                       isc_buffer_constinit(&b, dlv, strlen(dlv));
                        isc_buffer_add(&b, strlen(dlv));
                        tresult = dns_name_fromtext(name, &b, dns_rootname,
                                                    0, NULL);
@@ -1005,7 +1005,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx,
 
                        if (!cfg_obj_isvoid(anchor)) {
                                dlv = cfg_obj_asstring(anchor);
-                               isc_buffer_init(&b, dlv, strlen(dlv));
+                               isc_buffer_constinit(&b, dlv, strlen(dlv));
                                isc_buffer_add(&b, strlen(dlv));
                                tresult = dns_name_fromtext(name, &b,
                                                            dns_rootname,
@@ -1079,7 +1079,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx,
                (void)cfg_map_get(options, server_contact[i], &obj);
                if (obj != NULL) {
                        str = cfg_obj_asstring(obj);
-                       isc_buffer_init(&b, str, strlen(str));
+                       isc_buffer_constinit(&b, str, strlen(str));
                        isc_buffer_add(&b, strlen(str));
                        tresult = dns_name_fromtext(dns_fixedname_name(&fixed),
                                                    &b, dns_rootname, 0, NULL);
@@ -1103,7 +1103,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx,
        {
                obj = cfg_listelt_value(element);
                str = cfg_obj_asstring(obj);
-               isc_buffer_init(&b, str, strlen(str));
+               isc_buffer_constinit(&b, str, strlen(str));
                isc_buffer_add(&b, strlen(str));
                tresult = dns_name_fromtext(dns_fixedname_name(&fixed), &b,
                                            dns_rootname, 0, NULL);
@@ -1288,7 +1288,7 @@ check_update_policy(const cfg_obj_t *policy, isc_log_t *logctx) {
 
                dns_fixedname_init(&fixed);
                str = cfg_obj_asstring(identity);
-               isc_buffer_init(&b, str, strlen(str));
+               isc_buffer_constinit(&b, str, strlen(str));
                isc_buffer_add(&b, strlen(str));
                tresult = dns_name_fromtext(dns_fixedname_name(&fixed), &b,
                                            dns_rootname, 0, NULL);
@@ -1302,7 +1302,7 @@ check_update_policy(const cfg_obj_t *policy, isc_log_t *logctx) {
                    strcasecmp(cfg_obj_asstring(matchtype), "zonesub") != 0) {
                        dns_fixedname_init(&fixed);
                        str = cfg_obj_asstring(dname);
-                       isc_buffer_init(&b, str, strlen(str));
+                       isc_buffer_constinit(&b, str, strlen(str));
                        isc_buffer_add(&b, strlen(str));
                        tresult = dns_name_fromtext(dns_fixedname_name(&fixed),
                                                    &b, dns_rootname, 0, NULL);
@@ -1548,7 +1548,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
         * deals with strings.
         */
        dns_fixedname_init(&fixedname);
-       isc_buffer_init(&b, znamestr, strlen(znamestr));
+       isc_buffer_constinit(&b, znamestr, strlen(znamestr));
        isc_buffer_add(&b, strlen(znamestr));
        tresult = dns_name_fromtext(dns_fixedname_name(&fixedname), &b,
                                    dns_rootname, DNS_NAME_DOWNCASE, NULL);
@@ -1846,7 +1846,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
                        snamestr = cfg_obj_asstring(obj);
 
                        dns_fixedname_init(&fixed_sname);
-                       isc_buffer_init(&b2, snamestr, strlen(snamestr));
+                       isc_buffer_constinit(&b2, snamestr, strlen(snamestr));
                        isc_buffer_add(&b2, strlen(snamestr));
                        sname = dns_fixedname_name(&fixed_sname);
                        tresult = dns_name_fromtext(sname, &b2, dns_rootname,
@@ -2038,7 +2038,7 @@ check_keylist(const cfg_obj_t *keys, isc_symtab_t *symtab,
                isc_buffer_t b;
                char *keyname;
 
-               isc_buffer_init(&b, keyid, strlen(keyid));
+               isc_buffer_constinit(&b, keyid, strlen(keyid));
                isc_buffer_add(&b, strlen(keyid));
                tresult = dns_name_fromtext(name, &b, dns_rootname,
                                            0, NULL);
@@ -2207,7 +2207,7 @@ check_servers(const cfg_obj_t *config, const cfg_obj_t *voptions,
                         */
                        keyval = cfg_obj_asstring(keys);
                        dns_fixedname_init(&fname);
-                       isc_buffer_init(&b, keyval, strlen(keyval));
+                       isc_buffer_constinit(&b, keyval, strlen(keyval));
                        isc_buffer_add(&b, strlen(keyval));
                        keyname = dns_fixedname_name(&fname);
                        tresult = dns_name_fromtext(keyname, &b, dns_rootname,
@@ -2252,7 +2252,7 @@ check_trusted_key(const cfg_obj_t *key, isc_boolean_t managed,
        keyname = dns_fixedname_name(&fkeyname);
        keynamestr = cfg_obj_asstring(cfg_tuple_get(key, "name"));
 
-       isc_buffer_init(&b, keynamestr, strlen(keynamestr));
+       isc_buffer_constinit(&b, keynamestr, strlen(keynamestr));
        isc_buffer_add(&b, strlen(keynamestr));
        result = dns_name_fromtext(keyname, &b, dns_rootname, 0, NULL);
        if (result != ISC_R_SUCCESS) {
index bb26537195e76c90da967eb8fc0654e192b493ee..8da954cb45a28a6fb13e1609e259fe277fd4fa23 100644 (file)
@@ -507,7 +507,7 @@ dns_dlz_writeablezone(dns_view_t *view, dns_dlzdb_t *dlzdb,
 
        REQUIRE(dlzdb->configure_callback != NULL);
 
-       isc_buffer_init(&buffer, zone_name, strlen(zone_name));
+       isc_buffer_constinit(&buffer, zone_name, strlen(zone_name));
        isc_buffer_add(&buffer, strlen(zone_name));
        dns_fixedname_init(&fixorigin);
        result = dns_name_fromtext(dns_fixedname_name(&fixorigin),
index 46547829d944aa38116188dd22f399d0a8d18737..7fb21e138c3c8c99631d019991855be4760ac25f 100644 (file)
@@ -2420,7 +2420,7 @@ dns_name_fromstring2(dns_name_t *target, const char *src,
 
        REQUIRE(src != NULL);
 
-       isc_buffer_init(&buf, src, strlen(src));
+       isc_buffer_constinit(&buf, src, strlen(src));
        isc_buffer_add(&buf, strlen(src));
        if (BINDABLE(target) && target->buffer != NULL)
                name = target;
index c55d73dddf5bce631de4ef6a22de2153a4753265..e6cbfe2727ccb2d3179e229ab58e16aa7968ca01 100644 (file)
@@ -533,7 +533,7 @@ dns_peer_setkeybycharp(dns_peer_t *peer, const char *keyval) {
        isc_result_t result;
 
        dns_fixedname_init(&fname);
-       isc_buffer_init(&b, keyval, strlen(keyval));
+       isc_buffer_constinit(&b, keyval, strlen(keyval));
        isc_buffer_add(&b, strlen(keyval));
        result = dns_name_fromtext(dns_fixedname_name(&fname), &b,
                                   dns_rootname, 0, NULL);
index cca5d836edfeb2332b5422784983ccdc043288ff..bfc7a8716824b30f8407cb52c3da345d0d15aced 100644 (file)
@@ -382,7 +382,7 @@ dns_sdb_putrr(dns_sdblookup_t *lookup, const char *type, dns_ttl_t ttl,
        datalen = strlen(data);
        size = initial_size(datalen);
        do {
-               isc_buffer_init(&b, data, datalen);
+               isc_buffer_constinit(&b, data, datalen);
                isc_buffer_add(&b, datalen);
                result = isc_lex_openbuffer(lex, &b);
                if (result != ISC_R_SUCCESS)
@@ -448,7 +448,7 @@ getnode(dns_sdballnodes_t *allnodes, const char *name, dns_sdbnode_t **nodep) {
                origin = &sdb->common.origin;
        else
                origin = dns_rootname;
-       isc_buffer_init(&b, name, strlen(name));
+       isc_buffer_constinit(&b, name, strlen(name));
        isc_buffer_add(&b, strlen(name));
 
        result = dns_name_fromtext(newname, &b, origin, 0, NULL);
index c80cce1caa334c41db4619fb337335e6a548af49..7ff4ee72640108dd8d38abfd32f1f4878dce1e38 100644 (file)
@@ -1847,7 +1847,7 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
 
        size = initial_size(data);
        do {
-               isc_buffer_init(&b, data, strlen(data));
+               isc_buffer_constinit(&b, data, strlen(data));
                isc_buffer_add(&b, strlen(data));
 
                result = isc_lex_openbuffer(lex, &b);
@@ -1913,7 +1913,7 @@ dns_sdlz_putnamedrr(dns_sdlzallnodes_t *allnodes, const char *name,
                origin = &sdlz->common.origin;
        else
                origin = dns_rootname;
-       isc_buffer_init(&b, name, strlen(name));
+       isc_buffer_constinit(&b, name, strlen(name));
        isc_buffer_add(&b, strlen(name));
 
        result = dns_name_fromtext(newname, &b, origin, 0, NULL);
index 50fa9a251f93bcd2ce4071fa4003ab6cbde7c3c2..dc7b37058a147e177729c050aeefbbbba9a5f975 100644 (file)
@@ -42,7 +42,7 @@
 static isc_result_t
 make_name(const char *src, dns_name_t *name) {
        isc_buffer_t b;
-       isc_buffer_init(&b, src, strlen(src));
+       isc_buffer_constinit(&b, src, strlen(src));
        isc_buffer_add(&b, strlen(src));
        return (dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
 }
index 7235a495419fedb47f2760317595b3369b5ad0fb..e403083457438bff0b464384bba8a6ce2fdfd849 100644 (file)
@@ -214,7 +214,7 @@ dns_test_makezone(const char *name, dns_zone_t **zonep, dns_view_t *view,
 
        CHECK(dns_zone_create(&zone, mctx));
 
-       isc_buffer_init(&buffer, name, strlen(name));
+       isc_buffer_constinit(&buffer, name, strlen(name));
        isc_buffer_add(&buffer, strlen(name));
        dns_fixedname_init(&fixorigin);
        origin = dns_fixedname_name(&fixorigin);
index fd1ba4cef8e9ce6c0c4121ddfbf8ed0a27f21cf1..46629f03286064d4f9a279085cfc6d3190919f2b 100644 (file)
@@ -82,7 +82,7 @@ make_querymessage(dns_message_t *message, const char *namestr,
 
        /* Construct qname */
        namelen = strlen(namestr);
-       isc_buffer_init(&b, namestr, namelen);
+       isc_buffer_constinit(&b, namestr, namelen);
        isc_buffer_add(&b, namelen);
        dns_fixedname_init(&fixedqname);
        qname0 = dns_fixedname_name(&fixedqname);
index 841f4f4c5025957877e35e8ec6335354be803065..c7c542b1e5d8c0c4d6dd3b9da374c850d2aca4e8 100644 (file)
@@ -204,7 +204,7 @@ addserver(dns_client_t *client, const char *addrstr, const char *namespace) {
 
        if (namespace != NULL) {
                namelen = strlen(namespace);
-               isc_buffer_init(&b, namespace, namelen);
+               isc_buffer_constinit(&b, namespace, namelen);
                isc_buffer_add(&b, namelen);
                dns_fixedname_init(&fname);
                name = dns_fixedname_name(&fname);
index 4a7d58bfbc50d666706771b1638c221f6a3d14bf..3c1d8e6d32cf2da34616f9c9ff38d0fafd4219cd 100644 (file)
@@ -144,8 +144,8 @@ configure_dnsseckeys(irs_dnsconf_t *conf, cfg_obj_t *cfgobj,
                        /* Configure key name */
                        dns_fixedname_init(&fkeyname);
                        keyname_base = dns_fixedname_name(&fkeyname);
-                       isc_buffer_init(&namebuf, keynamestr,
-                                       strlen(keynamestr));
+                       isc_buffer_constinit(&namebuf, keynamestr,
+                                            strlen(keynamestr));
                        isc_buffer_add(&namebuf, strlen(keynamestr));
                        result = dns_name_fromtext(keyname_base, &namebuf,
                                                   dns_rootname, 0, NULL);
index b2ed946214367c681f45e004dfd1fa0c01b7e621..4e86706fe593f475b4a87d0cc2443f4223b79024 100644 (file)
@@ -552,7 +552,7 @@ make_resstate(isc_mem_t *mctx, gai_statehead_t *head, const char *hostname,
 
        /* Construct base domain name */
        namelen = strlen(domain);
-       isc_buffer_init(&b, domain, namelen);
+       isc_buffer_constinit(&b, domain, namelen);
        isc_buffer_add(&b, namelen);
        dns_fixedname_init(&fixeddomain);
        qdomain = dns_fixedname_name(&fixeddomain);
@@ -564,7 +564,7 @@ make_resstate(isc_mem_t *mctx, gai_statehead_t *head, const char *hostname,
 
        /* Construct query name */
        namelen = strlen(hostname);
-       isc_buffer_init(&b, hostname, namelen);
+       isc_buffer_constinit(&b, hostname, namelen);
        isc_buffer_add(&b, namelen);
        dns_fixedname_init(&state->fixedname);
        state->qname = dns_fixedname_name(&state->fixedname);
index 1b59e650acdec237559b82f91799a1b264a26465..eb57a658bcbd122da8da4508696b4cc586e7c509 100644 (file)
@@ -28,7 +28,7 @@
 #include <isc/util.h>
 
 void
-isc__buffer_init(isc_buffer_t *b, const void *base, unsigned int length) {
+isc__buffer_init(isc_buffer_t *b, void *base, unsigned int length) {
        /*
         * Make 'b' refer to the 'length'-byte region starting at 'base'.
         * XXXDCL see the comment in buffer.h about base being const.
index ae7e4c3dfc3464d934f91044bc47517af93ae062..b382c82c97657778e2d5a9064a5ca795b178a2fe 100644 (file)
@@ -222,7 +222,7 @@ isc_buffer_free(isc_buffer_t **dynbuffer);
  */
 
 void
-isc__buffer_init(isc_buffer_t *b, const void *base, unsigned int length);
+isc__buffer_init(isc_buffer_t *b, void *base, unsigned int length);
 /*!<
  * \brief Make 'b' refer to the 'length'-byte region starting at base.
  *
@@ -681,12 +681,7 @@ ISC_LANG_ENDDECLS
  */
 #define ISC__BUFFER_INIT(_b, _base, _length) \
        do { \
-               union { \
-                       const void *    konst; \
-                       void *          var; \
-               } _u; \
-               _u.konst = (_base); \
-               (_b)->base = _u.var; \
+               (_b)->base = _base; \
                (_b)->length = (_length); \
                (_b)->used = 0; \
                (_b)->current = 0; \
@@ -896,6 +891,13 @@ ISC_LANG_ENDDECLS
 #define isc_buffer_putuint32           isc__buffer_putuint32
 #endif
 
+#define isc_buffer_constinit(_b, _d, _l) \
+       do { \
+               union { void *_var; const void *_const; } _deconst; \
+               _deconst._const = (_d); \
+               isc_buffer_init((_b), _deconst._var, (_l)); \
+       } while (0)
+
 /*
  * No inline method for this one (yet).
  */
index 469989afcebb1e6ac1f6b8160079fb4ff831d964..af5659909e10062426d91480169b5a150e9c2415 100644 (file)
@@ -192,7 +192,7 @@ convert_keyname(const cfg_obj_t *keyobj, isc_log_t *lctx, isc_mem_t *mctx,
        const char *txtname = cfg_obj_asstring(keyobj);
 
        keylen = strlen(txtname);
-       isc_buffer_init(&buf, txtname, keylen);
+       isc_buffer_constinit(&buf, txtname, keylen);
        isc_buffer_add(&buf, keylen);
        dns_fixedname_init(&fixname);
        result = dns_name_fromtext(dns_fixedname_name(&fixname), &buf,