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

Function dupl_string

cachedb/cachedb_id.c:41–60  ·  view source on GitHub ↗

* Duplicate a string * \param dst destination * \param begin start of the string * \param end end of the string */

Source from the content-addressed store, hash-verified

39 * \param end end of the string
40 */
41static int dupl_string(char** dst, const char* begin, const char* end)
42{
43 str old, new;
44
45 if (*dst) pkg_free(*dst);
46
47 *dst = pkg_malloc(end - begin + 1);
48 if ((*dst) == NULL) {
49 LM_ERR("pkg malloc failed on %p/%p\n", begin, end);
50 return -1;
51 }
52
53 old.s = (char*)begin;
54 old.len = end - begin;
55 new.s = *dst;
56 un_escape(&old, &new );
57
58 new.s[new.len] = '\0';
59 return 0;
60}
61
62
63/**

Callers 1

parse_cachedb_urlFunction · 0.70

Calls 1

un_escapeFunction · 0.85

Tested by

no test coverage detected