* Duplicate a string * \param dst destination * \param begin start of the string * \param end end of the string */
| 39 | * \param end end of the string |
| 40 | */ |
| 41 | static 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 | /** |
no test coverage detected