MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / pkg_str_sync

Function pkg_str_sync

ut.h:1027–1044  ·  view source on GitHub ↗

* Ensure "dst" matches the content of "src" without leaking memory * * Note: if you just want to dup a string, use "pkg_str_dup()" instead */

Source from the content-addressed store, hash-verified

1025 * Note: if you just want to dup a string, use "pkg_str_dup()" instead
1026 */
1027static inline int pkg_str_sync(str* dst, const str* src)
1028{
1029 if (ZSTRP(src)) {
1030 if (dst->s)
1031 pkg_free(dst->s);
1032 memset(dst, 0, sizeof *dst);
1033 return 0;
1034 }
1035
1036 if (pkg_str_extend(dst, src->len) != 0) {
1037 LM_ERR("oom\n");
1038 return -1;
1039 }
1040
1041 memcpy(dst->s, src->s, src->len);
1042 dst->len = src->len;
1043 return 0;
1044}
1045
1046
1047

Callers 4

pv_set_sdpFunction · 0.85
pv_set_siprecFunction · 0.85
b2b_ua_server_initFunction · 0.85

Calls 1

pkg_str_extendFunction · 0.85

Tested by

no test coverage detected