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

Function new_cachedb_id

cachedb/cachedb_id.c:399–426  ·  view source on GitHub ↗

* Create a new connection identifier * \param url database URL * \return connection identifier, or zero on error */

Source from the content-addressed store, hash-verified

397 * \return connection identifier, or zero on error
398 */
399struct cachedb_id* new_cachedb_id(const str* url)
400{
401 struct cachedb_id* ptr;
402
403 if (!url || !url->s) {
404 LM_ERR("invalid parameter\n");
405 return 0;
406 }
407
408 ptr = pkg_malloc(sizeof(struct cachedb_id));
409 if (!ptr) {
410 LM_ERR("no private memory left\n");
411 goto err;
412 }
413 memset(ptr, 0, sizeof(struct cachedb_id));
414
415 if (parse_cachedb_url(ptr, url) < 0) {
416 LM_ERR("error while parsing database URL: '%s'\n",
417 db_url_escape(url));
418 goto err;
419 }
420
421 return ptr;
422
423 err:
424 if (ptr) pkg_free(ptr);
425 return 0;
426}
427
428
429/**

Callers 2

cachedb_do_initFunction · 0.85
test_cachedb_urlFunction · 0.85

Calls 2

parse_cachedb_urlFunction · 0.85
db_url_escapeFunction · 0.85

Tested by 1

test_cachedb_urlFunction · 0.68