mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
sexp.c: Use strncasecmp instead of strcasestr
strcasestr is not available on MS C runtime. Use strncasecmp instead which is in POSIX. MS C runtime has _strnicmp().
This commit is contained in:
parent
231c4bc04b
commit
7693881125
2 changed files with 3 additions and 7 deletions
|
@ -773,16 +773,12 @@
|
|||
#define SHUT_RD 0 /* SD_RECEIVE */
|
||||
#define SHUT_WR 1 /* SD_SEND */
|
||||
#define SHUT_RDWR 2 /* SD_BOTH */
|
||||
#if !defined(__MINGW32__) && !defined(__MINGW64__)
|
||||
#define strcasecmp lstrcmpi
|
||||
#define strncasecmp(s1, s2, n) lstrcmpi(s1, s2)
|
||||
#endif
|
||||
#include <shlwapi.h>
|
||||
#define strcasestr StrStrI
|
||||
#ifdef _MSC_VER
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#define _USE_MATH_DEFINES /* For M_LN10 */
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#pragma warning(disable:4146) /* unary minus operator to unsigned type */
|
||||
#if _MSC_VER < 1900
|
||||
#define snprintf(buf, len, fmt, val) sprintf(buf, fmt, val)
|
||||
|
|
2
sexp.c
2
sexp.c
|
@ -3226,7 +3226,7 @@ sexp sexp_read_raw (sexp ctx, sexp in, sexp *shares) {
|
|||
else if (strcasecmp(str+1, "nan.0") == 0)
|
||||
res = sexp_make_flonum(ctx, sexp_nan);
|
||||
#if SEXP_USE_COMPLEX
|
||||
else if (strcasestr(str+1, "inf.0") == str+1) {
|
||||
else if (strncasecmp(str+1, "inf.0", 5) == 0) {
|
||||
tmp = sexp_make_flonum(ctx, c1 == '+' ? sexp_pos_infinity : sexp_neg_infinity);
|
||||
if (str[6] == 0) {
|
||||
res = tmp;
|
||||
|
|
Loading…
Add table
Reference in a new issue