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

SU_DLL char* su_strcat ( su_home_t home,
char const *  s1,
char const *  s2 

Concate two strings, allocate memory for result from home.

Concatenate the strings s1 and s2. The strlen(s1)+strlen(s2)+1 bytes is allocated from home, the contents of s1 and s2 is copied to the newly allocated memory area, and pointer to the concatenated string is returned.

home pointer to memory home
s1 string to be first string
s2 string to be first string
Pointer to the newly created string is returned, or NULL upon an error.

Definition at line 77 of file su_strdup.c.

References su_alloc(), su_strcat(), and su_strdup().

Referenced by nth_site_create(), and su_strcat().

  size_t n1, n2;
  char *retval;

  if (s1 == NULL)
    return su_strdup(home, s2);
  else if (s2 == NULL)
    return su_strdup(home, s1);

  n1 = strlen(s1); n2 = strlen(s2);
  retval = su_alloc(home, n1 + n2 + 1);
  if (retval) {
    memcpy(retval, s1, n1);
    memcpy(retval + n1, s2, n2);
    retval[n1 + n2] = '\0';

  return retval;

Generated by  Doxygen 1.6.0   Back to index