Skip to content

Commit 4067155

Browse files
committed
[c89stringutils/c89stringutils_string_extras.c] Remove superfluous guards ; [{.github/workflows/linux-Windows-macOS-sunOS.yml,README.md}] Reflect (temporary) lack of SunOS testing
1 parent 198069f commit 4067155

File tree

3 files changed

+6
-27
lines changed

3 files changed

+6
-27
lines changed

.github/workflows/linux-Windows-macOS-sunOS.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Linux, Windows, macOS, SunOS
1+
name: Linux, Windows, macOS
22

33
on:
44
push:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
c89stringutils
22
==============
33
[![License](https://img.shields.io/badge/license-Apache--2.0%20OR%20MIT-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4-
[![CI for Linux, Windows, macOS, sunOS](https://github.com/offscale/c89stringutils/actions/workflows/linux-Windows-macOS-sunOS.yml/badge.svg)](https://github.com/offscale/c89stringutils/actions/workflows/github-actions.yml)
4+
[![CI for Linux, Windows, macOS](https://github.com/offscale/c89stringutils/actions/workflows/linux-Windows-macOS-sunOS.yml/badge.svg)](https://github.com/offscale/c89stringutils/actions/workflows/github-actions.yml)
55
[![CI for FreeBSD](https://api.cirrus-ci.com/github/offscale/c89stringutils.svg)](https://cirrus-ci.com/github/offscale/c89stringutils)
66
[![C89](https://img.shields.io/badge/C-89-blue)](https://en.wikipedia.org/wiki/C89_(C_version))
77

c89stringutils/c89stringutils_string_extras.c

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
#include <string.h>
1111
#include <stdlib.h>
1212

13-
#if !defined(HAVE_SNPRINTF_H)
13+
#ifndef HAVE_SNPRINTF_H
1414
#define HAVE_SNPRINTF_H
15+
1516
/*
1617
* `snprintf`, `vsnprintf`, `strnstr` taken from:
1718
* https://chromium.googlesource.com/chromium/blink/+/5cedd2fd208daf119b9ea47c7c1e22d760a586eb/Source/wtf/StringExtras.h
@@ -32,10 +33,6 @@
3233

3334
#else
3435

35-
#ifdef ANY_BSD
36-
#define vsnprintf _vsnprintf
37-
#endif /* !ANY_BSD */
38-
3936
inline int snprintf(char *buffer, size_t count, const char *format, ...) {
4037
int result;
4138
va_list args;
@@ -67,24 +64,20 @@ inline double wtf_vsnprintf(char *buffer, size_t count, const char *format,
6764

6865
#endif /* OLD_MSVC */
6966

70-
#endif /* !defined(HAVE_SNPRINTF_H) */
67+
#endif /* !HAVE_SNPRINTF_H */
7168

7269
#ifndef HAVE_STRNCASECMP_H
7370

74-
#if !defined(HAVE_STRNCASECMP_H)
7571
#define HAVE_STRNCASECMP_H
7672

7773
#define strncasecmp _strnicmp
7874
#define strcasecmp _stricmp
7975

80-
#endif /* !defined(HAVE_STRNCASECMP_H) */
81-
8276
#endif /* !HAVE_STRNCASECMP_H */
8377

8478
#ifndef HAVE_STRNSTR
85-
86-
#if !defined(HAVE_STRNSTR)
8779
#define HAVE_STRNSTR
80+
8881
char *strnstr(const char *buffer, const char *target, size_t bufferLength) {
8982
/*
9083
Find the first occurrence of find in s, where the search is limited to the
@@ -115,13 +108,11 @@ char *strnstr(const char *buffer, const char *target, size_t bufferLength) {
115108
}
116109
return 0;
117110
}
118-
#endif /* !defined(HAVE_STRNSTR) */
119111

120112
#endif /* !HAVE_STRNSTR */
121113

122114
#ifndef HAVE_STRCASESTR_H
123115

124-
#if !defined(HAVE_STRCASESTR_H)
125116
#define HAVE_STRCASESTR_H
126117

127118
/* `strcasestr` from MUSL */
@@ -134,13 +125,10 @@ char *strcasestr(const char *h, const char *n) {
134125
return 0;
135126
}
136127

137-
#endif /* !defined(HAVE_STRCASESTR_H) */
138-
139128
#endif /* !HAVE_STRCASESTR_H */
140129

141130
#ifndef HAVE_STRERRORLEN_S
142131

143-
#if !defined(HAVE_STRERRORLEN_S)
144132
#define HAVE_STRERRORLEN_S
145133
/* MIT licensed function from Safe C Library */
146134

@@ -186,13 +174,9 @@ size_t strerrorlen_s(errno_t errnum) {
186174
}
187175
}
188176

189-
#endif /* !defined(HAVE_STRERRORLEN_S) */
190-
191177
#endif /* !HAVE_STRERRORLEN_S */
192178

193179
#ifndef HAVE_ASPRINTF
194-
195-
#if !defined(HAVE_ASPRINTF)
196180
#define HAVE_ASPRINTF
197181

198182
#include <errno.h>
@@ -265,13 +249,9 @@ extern int asprintf(char **str, const char *fmt, ...) {
265249
return ret;
266250
}
267251

268-
#endif /* !defined(HAVE_ASPRINTF) */
269-
270252
#endif /* !HAVE_ASPRINTF */
271253

272254
#ifndef HAVE_JASPRINTF
273-
274-
#if !defined(HAVE_JASPRINTF)
275255
#define HAVE_JASPRINTF
276256
char *jasprintf(char **unto, const char *fmt, ...) {
277257
va_list args;
@@ -297,5 +277,4 @@ char *jasprintf(char **unto, const char *fmt, ...) {
297277

298278
return result;
299279
}
300-
#endif /* !defined(HAVE_JASPRINTF) */
301280
#endif /* !HAVE_JASPRINTF */

0 commit comments

Comments
 (0)