crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs

xstrcat.c (739B)


      1 /*************************************************************************
      2  * This file is part of Crosroads 1.23, a load balancer and fail over
      3  * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL.
      4  * Visit http://crossroads.e-tunity.com for information.
      5  *************************************************************************/
      6 #include "crossroads.h"
      7 
      8 char *xstrcat (char *what, char const *rest) {
      9     if (!what || !*what)
     10 	return (xstrdup (rest));
     11     if (!rest || !*rest)
     12 	return (what);
     13     
     14     if (! (what = realloc (what, strlen(what) + strlen(rest) + 1)) )
     15 	error ("Out of memory (while adding '%s' to '%s'",
     16 	       rest, what);
     17     strlcat (what, rest, strlen(what) + strlen(rest) + 1);
     18     return (what);
     19 }