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

Function new_db_id

db/db_id.c:312–342  ·  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

310 * \return connection identifier, or zero on error
311 */
312struct db_id* new_db_id(const str* url)
313{
314 struct db_id* ptr;
315
316 if (!url || !url->s) {
317 LM_ERR("invalid parameter\n");
318 return 0;
319 }
320
321 ptr = (struct db_id*)pkg_malloc(sizeof(struct db_id));
322 if (!ptr) {
323 LM_ERR("no private memory left\n");
324 goto err;
325 }
326 memset(ptr, 0, sizeof(struct db_id));
327
328 if (parse_db_url(ptr, url) < 0) {
329 LM_ERR("error while parsing database URL: '%.*s' \n", url->len, url->s);
330 goto err;
331 }
332
333 /* store the original url */
334 ptr->url.s = url->s;
335 ptr->url.len = url->len;
336
337 return ptr;
338
339 err:
340 if (ptr) pkg_free(ptr);
341 return 0;
342}
343
344
345/**

Callers 4

db_get_urlFunction · 0.85
db_http_initFunction · 0.85
rmq_parse_rmFunction · 0.85
db_do_initFunction · 0.85

Calls 1

parse_db_urlFunction · 0.85

Tested by

no test coverage detected