summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/regex/regex_internal.h4
-rw-r--r--libc/misc/regex/regexec.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/libc/misc/regex/regex_internal.h b/libc/misc/regex/regex_internal.h
index 03f08bf52..0a255e37f 100644
--- a/libc/misc/regex/regex_internal.h
+++ b/libc/misc/regex/regex_internal.h
@@ -46,10 +46,14 @@
# include <stdint.h>
#endif
+#ifdef __UCLIBC_HAS_THREADS__
+#include <bits/libc-lock.h>
+#else
#define __libc_lock_define(CLASS, NAME)
#define __libc_lock_init(NAME) do { } while (0)
#define __libc_lock_lock(NAME) do { } while (0)
#define __libc_lock_unlock(NAME) do { } while (0)
+#endif
#undef gettext
#undef gettext_noop
diff --git a/libc/misc/regex/regexec.c b/libc/misc/regex/regexec.c
index 92cbd821a..568108a67 100644
--- a/libc/misc/regex/regexec.c
+++ b/libc/misc/regex/regexec.c
@@ -222,7 +222,7 @@ regexec (preg, string, nmatch, pmatch, eflags)
{
reg_errcode_t err;
int start, length;
-#ifndef __UCLIBC__ /* libc_lock_lock does not exist */
+#ifdef __UCLIBC_HAS_THREADS__
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
#endif
@@ -382,10 +382,9 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
regmatch_t *pmatch;
int nregs, rval;
int eflags = 0;
-#ifndef __UCLIBC__ /* libc_lock_lock does not exist */
+#ifdef __UCLIBC_HAS_THREADS__
re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
#endif
-
/* Check for out-of-range. */
if (BE (start < 0 || start > length, 0))
return -1;