summaryrefslogtreecommitdiffstats
path: root/src/xregex.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-06-26 15:04:13 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-06-26 15:04:13 -0400
commit1313875b02c690ca5a40e585d24fdec240bb419d (patch)
tree6cd7733b8e3ae07129955fcb627f313032456f10 /src/xregex.c
parentabd29143d805fa16c65489d5b1d79428943d0187 (diff)
downloadbfs-1313875b02c690ca5a40e585d24fdec240bb419d.tar.xz
thread: Wrap more pthread APIs
Diffstat (limited to 'src/xregex.c')
-rw-r--r--src/xregex.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/xregex.c b/src/xregex.c
index 88df082..beb6676 100644
--- a/src/xregex.c
+++ b/src/xregex.c
@@ -5,6 +5,7 @@
#include "alloc.h"
#include "config.h"
#include "diag.h"
+#include "thread.h"
#include "sanity.h"
#include <errno.h>
#include <pthread.h>
@@ -106,9 +107,7 @@ static void bfs_onig_once(void) {
/** Initialize Oniguruma. */
static int bfs_onig_initialize(OnigEncoding *enc) {
static pthread_once_t once = PTHREAD_ONCE_INIT;
- if (pthread_once(&once, bfs_onig_once) != 0) {
- return ONIGERR_FAIL_TO_INITIALIZE;
- }
+ call_once(&once, bfs_onig_once);
*enc = bfs_onig_enc;
return bfs_onig_status;