Skip to content

Commit a9564eb

Browse files
committed
[c89stringutils/c89stringutils_string_extras{.h,.c}] OpenBSD support ; [*.h,*.c] clang-format
1 parent a585f77 commit a9564eb

File tree

3 files changed

+42
-41
lines changed

3 files changed

+42
-41
lines changed

c89stringutils/c89stringutils_export_pregen.h

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,54 @@
33
#define C89STRINGUTILS_EXPORT_H
44

55
#ifdef C89STRINGUTILS_STATIC_DEFINE
6-
# define C89STRINGUTILS_EXPORT
7-
# define C89STRINGUTILS_NO_EXPORT
6+
#define C89STRINGUTILS_EXPORT
7+
#define C89STRINGUTILS_NO_EXPORT
88
#else
9-
# ifndef C89STRINGUTILS_EXPORT
10-
# ifdef c89stringutils_EXPORTS
11-
/* We are building this library */
12-
# if defined(BUILD_SHARED)
13-
# define C89STRINGUTILS_EXPORT __declspec(dllexport)
14-
# else
15-
# define C89STRINGUTILS_EXPORT
16-
# endif
17-
# endif
18-
# else
19-
/* We are using this library */
20-
# if defined(BUILD_SHARED)
21-
# define C89STRINGUTILS_EXPORT __declspec(dllimport)
22-
# else
23-
# define C89STRINGUTILS_EXPORT
24-
# endif
25-
# endif
9+
#ifndef C89STRINGUTILS_EXPORT
10+
#ifdef c89stringutils_EXPORTS
11+
/* We are building this library */
12+
#if defined(BUILD_SHARED)
13+
#define C89STRINGUTILS_EXPORT __declspec(dllexport)
14+
#else
15+
#define C89STRINGUTILS_EXPORT
16+
#endif
17+
#endif
18+
#else
19+
/* We are using this library */
20+
#if defined(BUILD_SHARED)
21+
#define C89STRINGUTILS_EXPORT __declspec(dllimport)
22+
#else
23+
#define C89STRINGUTILS_EXPORT
24+
#endif
25+
#endif
2626

27-
# ifndef C89STRINGUTILS_NO_EXPORT
28-
# define C89STRINGUTILS_NO_EXPORT
29-
# endif
27+
#ifndef C89STRINGUTILS_NO_EXPORT
28+
#define C89STRINGUTILS_NO_EXPORT
29+
#endif
3030
#endif
3131

3232
#ifndef C89STRINGUTILS_DEPRECATED
33-
# if defined(BUILD_SHARED)
34-
# define C89STRINGUTILS_DEPRECATED __declspec(deprecated)
35-
# else
36-
# define C89STRINGUTILS_DEPRECATED
37-
# endif
33+
#if defined(BUILD_SHARED)
34+
#define C89STRINGUTILS_DEPRECATED __declspec(deprecated)
35+
#else
36+
#define C89STRINGUTILS_DEPRECATED
37+
#endif
3838
#endif
3939

4040
#ifndef C89STRINGUTILS_DEPRECATED_EXPORT
41-
# define C89STRINGUTILS_DEPRECATED_EXPORT C89STRINGUTILS_EXPORT C89STRINGUTILS_DEPRECATED
41+
#define C89STRINGUTILS_DEPRECATED_EXPORT \
42+
C89STRINGUTILS_EXPORT C89STRINGUTILS_DEPRECATED
4243
#endif
4344

4445
#ifndef C89STRINGUTILS_DEPRECATED_NO_EXPORT
45-
# define C89STRINGUTILS_DEPRECATED_NO_EXPORT C89STRINGUTILS_NO_EXPORT C89STRINGUTILS_DEPRECATED
46+
#define C89STRINGUTILS_DEPRECATED_NO_EXPORT \
47+
C89STRINGUTILS_NO_EXPORT C89STRINGUTILS_DEPRECATED
4648
#endif
4749

4850
#if 0 /* DEFINE_NO_DEPRECATED */
49-
# ifndef C89STRINGUTILS_NO_DEPRECATED
50-
# define C89STRINGUTILS_NO_DEPRECATED
51-
# endif
51+
#ifndef C89STRINGUTILS_NO_DEPRECATED
52+
#define C89STRINGUTILS_NO_DEPRECATED
53+
#endif
5254
#endif
5355

5456
#endif /* C89STRINGUTILS_EXPORT_H */

c89stringutils/c89stringutils_string_extras.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#include <stdarg.h>
99
#include <stdio.h>
10-
#include <string.h>
1110
#include <stdlib.h>
11+
#include <string.h>
1212

1313
#ifndef HAVE_SNPRINTF_H
1414
#define HAVE_SNPRINTF_H
@@ -28,9 +28,6 @@
2828
#define snprintf _snprintf
2929
#define vsnprintf _vsnprintf
3030

31-
32-
33-
3431
#else
3532

3633
#ifdef ANY_BSD

c89stringutils/c89stringutils_string_extras.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#ifndef C89STRINGUTILS_STRING_EXTRAS_H
77
#define C89STRINGUTILS_STRING_EXTRAS_H
88

9+
#include "c89stringutils_export.h"
910
#include <stdarg.h>
1011
#include <stdio.h>
1112
#include <string.h>
12-
#include "c89stringutils_export.h"
1313

1414
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
1515
defined(__bsdi__) || defined(__DragonFly__) || defined(BSD)
@@ -29,7 +29,7 @@
2929
#else
3030

3131
#define OLD_MSVC
32-
/* !defined(MSC_VER) || MSC_VER > 1400 *//* 1400 is MSVC 2005 */
32+
/* !defined(MSC_VER) || MSC_VER > 1400 */ /* 1400 is MSVC 2005 */
3333

3434
#endif /* _MSC_VER >= 1900 */
3535

@@ -63,7 +63,7 @@
6363
#endif /* defined(__APPLE__) && defined(__MACH__) */
6464

6565
#if defined(BSD) && (BSD >= 199306) && !defined(__linux__) && \
66-
!defined(linux) && !defined(__linux)
66+
!defined(linux) && !defined(__linux) && !defined(__OpenBSD__)
6767
#define HAVE_STRNSTR
6868
#endif /* defined(BSD) && (BSD >= 199306) && !defined(__linux__) && \
6969
!defined(linux) && !defined(__linux) */
@@ -106,7 +106,8 @@ typedef int errno_t;
106106

107107
#ifndef HAVE_STRNCASECMP_H
108108

109-
extern C89STRINGUTILS_EXPORT int strncasecmp(const char *, const char *, size_t);
109+
extern C89STRINGUTILS_EXPORT int strncasecmp(const char *, const char *,
110+
size_t);
110111

111112
extern C89STRINGUTILS_EXPORT int strcasecmp(const char *, const char *);
112113

@@ -132,7 +133,8 @@ extern C89STRINGUTILS_EXPORT size_t strerrorlen_s(errno_t);
132133

133134
#ifndef HAVE_ASPRINTF
134135

135-
extern C89STRINGUTILS_EXPORT int vasprintf(char **str, const char *fmt, va_list ap);
136+
extern C89STRINGUTILS_EXPORT int vasprintf(char **str, const char *fmt,
137+
va_list ap);
136138

137139
extern C89STRINGUTILS_EXPORT int asprintf(char **str, const char *fmt, ...);
138140

0 commit comments

Comments
 (0)