* Make a copy of a str structure using pkg_malloc */
| 969 | * Make a copy of a str structure using pkg_malloc |
| 970 | */ |
| 971 | static inline int pkg_str_dup(str* dst, const str* src) |
| 972 | { |
| 973 | dst->s = pkg_malloc(src->len); |
| 974 | if (!dst->s) { |
| 975 | LM_ERR("no private memory left\n"); |
| 976 | dst->len = 0; |
| 977 | return -1; |
| 978 | } |
| 979 | |
| 980 | memcpy(dst->s, src->s, src->len); |
| 981 | dst->len = src->len; |
| 982 | return 0; |
| 983 | } |
| 984 | |
| 985 | static inline char *pkg_strdup(const char *str) |
| 986 | { |
no outgoing calls
no test coverage detected