Module: kamailio
Branch: master
Commit: 6a5483a1767f689bc5ad261e2ead86da33c0dc73
URL:
https://github.com/kamailio/kamailio/commit/6a5483a1767f689bc5ad261e2ead86d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-01-03T11:17:28+01:00
core: rpc - removed define switch for copying rpc export
- set for many years without change
---
Modified: src/core/rpc_lookup.c
---
Diff:
https://github.com/kamailio/kamailio/commit/6a5483a1767f689bc5ad261e2ead86d…
Patch:
https://github.com/kamailio/kamailio/commit/6a5483a1767f689bc5ad261e2ead86d…
---
diff --git a/src/core/rpc_lookup.c b/src/core/rpc_lookup.c
index 5203609db3..f1e6e06617 100644
--- a/src/core/rpc_lookup.c
+++ b/src/core/rpc_lookup.c
@@ -29,8 +29,6 @@
#define RPC_HASH_SIZE 32
#define RPC_SARRAY_SIZE 32 /* initial size */
-#define RPC_COPY_EXPORT
-
static struct str_hash_table rpc_hash_table;
/* array of pointer to rpc exports, sorted after their name
@@ -97,21 +95,15 @@ static int rpc_hash_add(struct rpc_export* rpc)
doc1_len=rpc->doc_str[1]?strlen(rpc->doc_str[1]):0;
/* alloc everything into one block */
-#ifdef RPC_COPY_EXPORT
e=pkg_malloc(ROUND_POINTER(sizeof(struct str_hash_entry))
+ROUND_POINTER(sizeof(*rpc))+2*sizeof(char*)+
+name_len+1+doc0_len+(rpc->doc_str[0]!=0)
+doc1_len+(rpc->doc_str[1]!=0)
);
-#else /* RPC_COPY_EXPORT */
- e=pkg_malloc(ROUND_POINTER(sizeof(struct str_hash_entry)));
-#endif /* RPC_COPY_EXPORT */
-
if (e==0){
PKG_MEM_ERROR;
goto error;
}
-#ifdef RPC_COPY_EXPORT
n_rpc=(rpc_export_t*)((char*)e+
ROUND_POINTER(sizeof(struct str_hash_entry)));
/* copy rpc into n_rpc */
@@ -135,9 +127,6 @@ static int rpc_hash_add(struct rpc_export* rpc)
}else{
n_rpc->doc_str[1]=0;
}
-#else /* RPC_COPY_EXPORT */
- n_rpc=rpc;
-#endif /* RPC_COPY_EXPORT */
e->key.s=(char*)n_rpc->name;
e->key.len=name_len;