]>
git.ipfire.org Git - thirdparty/squid.git/blob - compat/xstring.cc
2 #include "compat/xalloc.h"
3 #include "compat/xstring.h"
15 (*failure_notify
) ("xstrdup: tried to dup a NULL pointer!\n");
18 perror("xstrdup: tried to dup a NULL pointer!");
23 /* copy string, including terminating character */
25 p
= (char *)xmalloc(sz
);
32 xstrncpy(char *dst
, const char *src
, size_t n
)
40 while (--n
!= 0 && *src
!= '\0') {
51 xstrndup(const char *s
, size_t n
)
59 (*failure_notify
) ("xstrndup: tried to dup a NULL pointer!\n");
61 perror("xstrndup: tried to dup a NULL pointer!");
67 // size_t is unsigned, as mandated by c99 and c++ standards.
71 p
= xstrncpy((char *)xmalloc(sz
), s
, sz
);