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

SU_DLL void* su_home_new ( isize_t  size  ) 

Create a new su_home_t object.

Create a home object used to collect multiple memory allocations under one handle. The memory allocations made using this home object is freed either when this home is destroyed.

The maximum size of a home object is INT_MAX (2 gigabytes).

size size of home object
The memory home object allocated with su_home_new() can be reclaimed with su_home_unref().

This function returns a pointer to an su_home_t object, or NULL upon an error.

Definition at line 548 of file su_alloc.c.

References su_home_new().

Referenced by auth_mod_alloc(), msg_create(), nea_create(), nea_server_create(), nta_agent_create(), nua_create(), server_create(), soa_clone(), soa_create(), sres_cache_new(), stun_dns_lookup(), su_home_clone(), su_home_create(), and su_home_new().

  su_home_t *home;

  assert(size >= sizeof (*home));

  if (size < sizeof (*home))
    return (void)(errno = EINVAL), NULL;
  else if (size > INT_MAX)
    return (void)(errno = ENOMEM), NULL;

  home = calloc(1, size);
  if (home) {
    home->suh_size = (int)size;
    home->suh_blocks = su_hash_alloc(SUB_N);
    if (home->suh_blocks)
      home->suh_blocks->sub_hauto = 0;
      safefree(home), home = NULL;

  return home;

Generated by  Doxygen 1.6.0   Back to index