Module: kamailio
Branch: master
Commit: 2300d0a2a9c78c72c67596eb129cf7bf86bf300b
URL:
https://github.com/kamailio/kamailio/commit/2300d0a2a9c78c72c67596eb129cf7b…
Author: Alex Hermann <alex(a)hexla.nl>
Committer: Alex Hermann <alex(a)hexla.nl>
Date: 2020-10-29T15:24:22+01:00
kex: Let the RPC server do printf as it may have optimizations
Some RPC server implementations may print directly to the output buffer, so
this eliminates a string copy.
---
Modified: src/modules/kex/core_stats.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2300d0a2a9c78c72c67596eb129cf7b…
Patch:
https://github.com/kamailio/kamailio/commit/2300d0a2a9c78c72c67596eb129cf7b…
---
diff --git a/src/modules/kex/core_stats.c b/src/modules/kex/core_stats.c
index 1ebd235752..a1f14a7dc6 100644
--- a/src/modules/kex/core_stats.c
+++ b/src/modules/kex/core_stats.c
@@ -492,15 +492,13 @@ static void rpc_stats_get_statistics(rpc_t* rpc, void* ctx)
static void rpc_fetch_add_stat(rpc_t* rpc, void* ctx, void* hst, char* g, char* n,
unsigned long val, int numeric) {
char nbuf[128];
- char vbuf[32];
int res;
snprintf(nbuf, 127, "%s.%s", g, n);
if (numeric) {
res = rpc->struct_add(hst, "d", nbuf, val);
} else {
- snprintf(vbuf, 31, "%lu", val);
- res = rpc->struct_add(hst, "s", nbuf, vbuf);
+ res = rpc->struct_printf(hst, nbuf, "%lu", val);
}
if (res<0)
{