]>
git.ipfire.org Git - thirdparty/squid.git/blob - compat/xstring.h
2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_COMPAT_XSTRING_H
10 #define SQUID_COMPAT_XSTRING_H
21 * xstrdup() - same as strdup(3). Used for portability.
22 * Never returns NULL; fatal on error.
24 * Sets errno to EINVAL if a NULL pointer is passed.
26 * Define failure_notify to receive error message.
27 * otherwise perror() is used to display it.
29 char *xstrdup(const char *s
);
34 #define strdup(X) xstrdup((X))
37 * xstrncpy() - similar to strncpy(3) but terminates string
38 * always with '\0' if (n != 0 and dst != NULL),
39 * and doesn't do padding
41 char *xstrncpy(char *dst
, const char *src
, size_t n
);
44 * xstrndup() - same as strndup(3). Used for portability.
45 * Never returns NULL; fatal on error.
47 * Sets errno to EINVAL if a NULL pointer or negative
50 * Define failure_notify to receive error message.
51 * otherwise perror() is used to display it.
53 char *xstrndup(const char *s
, size_t n
);
58 #define strndup(X) xstrndup((X))
64 #endif /* SQUID_COMPAT_XSTRING_H */