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

Function pkg_str_extend

ut.h:1002–1020  ·  view source on GitHub ↗

Extend the given buffer only if needed */

Source from the content-addressed store, hash-verified

1000
1001/* Extend the given buffer only if needed */
1002static inline int pkg_str_extend(str *in, int size)
1003{
1004 char *p;
1005
1006 /* do not check for !in->s here, as it's better
1007 * to crash sooner on a corrupt @in string (e.g. {NULL, 172}) */
1008 if (in->len < size) {
1009 p = pkg_realloc(in->s, size);
1010 if (!p) {
1011 LM_ERR("oom\n");
1012 return -1;
1013 }
1014
1015 in->s = p;
1016 in->len = size;
1017 }
1018
1019 return 0;
1020}
1021
1022/*
1023 * Ensure "dst" matches the content of "src" without leaking memory

Callers 15

pkg_str_syncFunction · 0.85
do_assignFunction · 0.85
pv_get_routeFunction · 0.85
tr_eval_sdpFunction · 0.85
db_url_escapeFunction · 0.85
mongo_con_raw_queryFunction · 0.85
mongo_print_cdb_keyFunction · 0.85
pv_get_xmlFunction · 0.85
redis_map_setFunction · 0.85
cassandra_setFunction · 0.85
cassandra_getFunction · 0.85
_cassandra_removeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected