xstring.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9#ifndef SQUID_COMPAT_XSTRING_H
10#define SQUID_COMPAT_XSTRING_H
11
12#if HAVE_STRING_H
13#include <string.h>
14#endif
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
29char *xstrdup(const char *s);
30
31#ifdef strdup
32#undef strdup
33#endif
34#define strdup(X) xstrdup((X))
35
36/*
37 * xstrncpy() - similar to strncpy(3) but terminates string
38 * always with '\0' if (n != 0 and dst != nullptr),
39 * and doesn't do padding
40 */
41char *xstrncpy(char *dst, const char *src, size_t n);
42
56char *xstrndup(const char *s, size_t n);
57
58#ifdef strndup
59#undef strndup
60#endif
61#define strndup(X) xstrndup((X))
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif /* SQUID_COMPAT_XSTRING_H */
68
char * xstrncpy(char *dst, const char *src, size_t n)
Definition: xstring.cc:37
char * xstrdup(const char *s)
Definition: xstring.cc:16
char * xstrndup(const char *s, size_t n)
Definition: xstring.cc:56

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors