]>
git.ipfire.org Git - thirdparty/squid.git/blob - compat/xstring.cc
2 #include "compat/xalloc.h"
3 #include "compat/xstring.h"
10 xstrdup(const char *s
)
17 (*failure_notify
) ("xstrdup: tried to dup a NULL pointer!\n");
20 perror("xstrdup: tried to dup a NULL pointer!");
25 /* copy string, including terminating character */
27 p
= (char *)xmalloc(sz
);
34 xstrncpy(char *dst
, const char *src
, size_t n
)
42 while (--n
!= 0 && *src
!= '\0')
50 xstrndup(const char *s
, size_t n
)
58 (*failure_notify
) ("xstrndup: tried to dup a NULL pointer!\n");
60 perror("xstrndup: tried to dup a NULL pointer!");
67 (*failure_notify
) ("xstrndup: tried to dup a negative length string!\n");
69 perror("xstrndup: tried to dup a negative length string!");
78 p
= xstrncpy((char *)xmalloc(sz
), s
, sz
);