]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9775: Added salloc call to dht for stack allocation, passing on the pool
authorShane Bryldt <astaelan@gmail.com>
Wed, 30 Nov 2016 06:27:14 +0000 (06:27 +0000)
committerMike Jerris <mike@jerris.com>
Wed, 25 Jan 2017 20:59:33 +0000 (14:59 -0600)
This will be replicated to other allocations

libs/libks/src/dht/ks_dht.c
libs/libks/src/dht/ks_dht.h
libs/libks/src/dht/ks_dht_nodeid.c

index 7a25d78b4bcc75d6b1ec1cc58e89a688b519b21a..e93c424ba061064d963b454b10f2728a27d98b41 100644 (file)
@@ -22,6 +22,20 @@ KS_DECLARE(ks_status_t) ks_dht2_alloc(ks_dht2_t **dht, ks_pool_t *pool)
        return KS_STATUS_SUCCESS;
 }
 
+/**
+ *
+ */
+KS_DECLARE(ks_status_t) ks_dht2_salloc(ks_dht2_t *dht, ks_pool_t *pool)
+{
+       ks_assert(dht);
+       ks_assert(pool);
+
+       dht->pool = pool;
+       dht->pool_alloc = KS_FALSE;
+
+       return KS_STATUS_SUCCESS;
+}
+
 /**
  *
  */
@@ -45,6 +59,7 @@ KS_DECLARE(ks_status_t) ks_dht2_free(ks_dht2_t *dht)
 KS_DECLARE(ks_status_t) ks_dht2_init(ks_dht2_t *dht, const uint8_t *nodeid)
 {
        ks_assert(dht);
+       ks_assert(dht->pool);
 
        if (ks_dht2_nodeid_init(&dht->nodeid, nodeid) != KS_STATUS_SUCCESS) {
                return KS_STATUS_FAIL;
index 63c2852ba355412242866d58a117a0ed05364d71..af5a2d4b79ec18e24573dd76fba8229f63119bac 100644 (file)
@@ -35,6 +35,7 @@ struct ks_dht2_s {
 
 
 KS_DECLARE(ks_status_t) ks_dht2_alloc(ks_dht2_t **dht, ks_pool_t *pool);
+KS_DECLARE(ks_status_t) ks_dht2_salloc(ks_dht2_t *dht, ks_pool_t *pool);
 KS_DECLARE(ks_status_t) ks_dht2_free(ks_dht2_t *dht);
 
                                                
index 752f9ac70e96ae038e9c65aab1e72fe1f98e57d4..735213dce2f7f69aa41246ae0a5cccf3205988a1 100644 (file)
@@ -36,7 +36,6 @@ KS_DECLARE(ks_status_t) ks_dht2_nodeid_free(ks_dht2_nodeid_t *nodeid)
 KS_DECLARE(ks_status_t) ks_dht2_nodeid_init(ks_dht2_nodeid_t *nodeid, const uint8_t *id)
 {
        ks_assert(nodeid);
-       ks_assert(id);
 
        if (!id) {
                randombytes_buf(nodeid->id, KS_DHT_NODEID_LENGTH);