Module: kamailio Branch: master Commit: dd2167bcb35de1dd003bf4da0e03ab5dc2d50ab5 URL: https://github.com/kamailio/kamailio/commit/dd2167bcb35de1dd003bf4da0e03ab5d...
Author: Henning Westerholt hw@skalatan.de Committer: Henning Westerholt hw@skalatan.de Date: 2019-11-23T23:00:00+01:00
janssonrpcc: use core string handling instead of redundant implementation
---
Modified: src/modules/janssonrpcc/janssonrpc.h
---
Diff: https://github.com/kamailio/kamailio/commit/dd2167bcb35de1dd003bf4da0e03ab5d... Patch: https://github.com/kamailio/kamailio/commit/dd2167bcb35de1dd003bf4da0e03ab5d...
---
diff --git a/src/modules/janssonrpcc/janssonrpc.h b/src/modules/janssonrpcc/janssonrpc.h index 20b38c3fdd..3756c817e3 100644 --- a/src/modules/janssonrpcc/janssonrpc.h +++ b/src/modules/janssonrpcc/janssonrpc.h @@ -94,34 +94,14 @@ extern const str null_str; static inline str pkg_strdup(str src) { str res; - - if (!src.s) { - res.s = NULL; - res.len = 0; - } else if (!(res.s = (char *) pkg_malloc(src.len + 1))) { - res.len = 0; - } else { - strncpy(res.s, src.s, src.len); - res.s[src.len] = 0; - res.len = src.len; - } + pkg_str_dup(&src, &res); return res; }
static inline str shm_strdup(str src) { str res; - - if (!src.s) { - res.s = NULL; - res.len = 0; - } else if (!(res.s = (char *) shm_malloc(src.len + 1))) { - res.len = 0; - } else { - strncpy(res.s, src.s, src.len); - res.s[src.len] = 0; - res.len = src.len; - } + shm_str_dup(&src, &res); return res; }