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

char* su_strdup ( su_home_t home,
char const *  s 

su_strdup.c Home-based string duplication functions

Pekka Pessi <Pekka.Pessi@nokia.com>
Created: Wed Jul 19 10:06:14 2000 ppessi Duplicate a string, allocate memory from home.
The function su_strdup() duplicates the string s. It allocates strlen(s)+1 bytes from home, copies the contents of s to the newly allocated memory, and returns pointer to the duplicated string.

home pointer to memory home
s string to be duplicated
The function su_strdup() returns pointer to the newly created string, or NULL upon an error.

Definition at line 51 of file su_strdup.c.

References su_alloc().

Referenced by auc_copy_credentials(), auc_credentials(), auth_get_params(), auth_init_default(), msg_header_add_make(), msg_header_add_str(), msg_multipart_complete(), msg_params_join(), nta_agent_newtag(), nta_incoming_tag(), nta_leg_tcreate(), nua_generate_instance_identifier(), priv_sres_cb(), sip_allow_events_add(), sip_header_as_string(), sip_url_query_as_taglist(), sip_via_create(), soa_base_set_params(), soa_description_dup(), stun_atoaddr(), stun_handle_init(), su_strcat(), su_strlst_dup_split(), su_strlst_join(), su_vsprintf(), tport_open_log(), and url_query_as_header_string().

  if (s) {
    size_t n = strlen(s);
    char *retval = su_alloc(home, n + 1);
    if (retval)
      strncpy(retval, s, n)[n] = 0;
    return retval;
  return NULL;

Generated by  Doxygen 1.6.0   Back to index