Logo Search packages:      
Sourcecode: sofia-sip version File versions

SOFIAPUBFUN url_t* url_hdup ( su_home_t home,
url_t const *  src 

Duplicate the url to memory allocated via home

Duplicate the url to memory allocated via home.

The function url_hdup() duplicates (deep copies) an url_t structure. Alternatively, it can be passed a string; string is then copied and parsed to the url_t structure.

The function url_hdup() allocates the destination structure from home as a single memory block. It is possible to free the copied url structure and all the associated strings using a single call to su_free().

home memory home used to allocate new url object
src pointer to URL (or string)
The function url_hdup() returns a pointer to the newly allocated url_t structure, or NULL upon an error.

Definition at line 1177 of file url.c.

References su_alloc(), su_free(), url_dup(), url_hdup(), and url_xtra().

Referenced by auth_init_default(), nta_agent_add_tport(), nta_leg_by_dialog(), nta_leg_by_uri(), nta_leg_tcreate(), nth_site_create(), sip_url_dup(), url_format(), url_hdup(), url_make(), and url_map_find().

  if (src) {
    size_t len = sizeof(*src) + url_xtra(src);
    url_t *dst = su_alloc(home, len);
    if (dst) {
      ssize_t actual;
      actual = url_dup((char *)(dst + 1), len - sizeof(*src), dst, src);
      if (actual < 0)
      su_free(home, dst), dst = NULL;
      assert(len == sizeof(*src) + actual);
    return dst;
    return NULL;

Generated by  Doxygen 1.6.0   Back to index