Skip to content

Commit

Permalink
Windows does not have index
Browse files Browse the repository at this point in the history
  • Loading branch information
ohler55 committed Feb 4, 2022
1 parent 0c342a1 commit 6830082
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions ext/ox/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
have_func('pthread_mutex_init')
have_func('rb_enc_interned_str')
have_func('rb_time_nano_new')
have_func('index')

have_header('ruby/st.h')
have_header('sys/uio.h')
Expand Down
4 changes: 4 additions & 0 deletions ext/ox/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ next_white(PInfo pi) {
}

static void fix_newlines(char *buf) {
#if HAVE_INDEX
if (NULL != index(buf, '\r')) {
#endif
char *s = buf;
char *d = buf;

Expand All @@ -113,7 +115,9 @@ static void fix_newlines(char *buf) {
d++;
}
*d = '\0';
#if HAVE_INDEX
}
#endif
}

static void
Expand Down

0 comments on commit 6830082

Please sign in to comment.