UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
strings.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2024 CESNET
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, is permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 *
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 *
22 * 3. Neither the name of CESNET nor the names of its contributors may be
23 * used to endorse or promote products derived from this software without
24 * specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
27 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
28 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
29 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
30 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
31 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
36 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
37 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#ifndef COMPAT_STRINGS_H_D54CAFC8_A1A0_4FF5_80A0_91F34FB11E12
41#define COMPAT_STRINGS_H_D54CAFC8_A1A0_4FF5_80A0_91F34FB11E12
42
43#include <string.h>
44
45#ifdef _WIN32
46#ifndef strcasecmp
47#define strcasecmp _stricmp
48#endif
49#ifndef strncasecmp
50#define strncasecmp _strnicmp
51#endif // ! defined strncasecmp
52#else // ! defined _WIN32
53#include <strings.h>
54#endif // _WIN32
55
56#ifdef __cplusplus
57#define COMPAT_MISC_EXT_C extern "C"
58#else
59#define COMPAT_MISC_EXT_C extern
60#endif
61
62// strerror_s
63#ifndef _WIN32
64#ifndef __STDC_LIB_EXT1__
65#if ! defined __gnu_linux__ // XSI version on non-glibc
66#define strerror_s(buf, bufsz, errnum) strerror_r(errnum, buf, bufsz)
67#else // use the XSI variant from glibc (strerror_r is either GNU or XSI)
68COMPAT_MISC_EXT_C int __xpg_strerror_r(int errcode, char *buffer, size_t length);
69#define strerror_s(buf, bufsz, errnum) __xpg_strerror_r(errnum, buf, bufsz)
70#endif
71#endif // ! defined __STDC_LIB_EXT1__
72#endif // ! defined _WIN32
73
74// strdupa is defined as a macro
75#include <string.h>
76#ifndef strdupa
77#define strdupa(s) (char *) memcpy(alloca(strlen(s) + 1), s, strlen(s) + 1)
78#endif // defined strdupa
79
80#undef COMPAT_MISC_EXT_C
81
82#endif // ! defined COMPAT_STRINGS_H_D54CAFC8_A1A0_4FF5_80A0_91F34FB11E12
#define COMPAT_MISC_EXT_C
Definition strings.h:57