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

Function dupl_string

db/db_id.c:41–59  ·  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 return -1;
50 }
51
52 old.s = (char*)begin;
53 old.len = end - begin;
54 new.s = *dst;
55 un_escape(&old, &new );
56
57 new.s[new.len] = '\0';
58 return 0;
59}
60
61
62/**

Callers 1

parse_db_urlFunction · 0.70

Calls 1

un_escapeFunction · 0.85

Tested by

no test coverage detected