blob: bcd1525b670f9d2e8e2c2cc79a8e2338dbc62a29 [file] [log] [blame]
From 79381ab335898c9184e22dd25b544adefa9bf6c5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 7 Feb 2022 16:26:57 -0800
Subject: [PATCH] librewrite: include ldap_pvt_thread.h before redefining
calloc
This helps compiling with musl, where sched.h is included by
ldap_pvt_thread.h which provides prototype for calloc() and conflicts
/usr/include/sched.h:84:7: error: conflicting types for 'ber_memcalloc'
| void *calloc(size_t, size_t);
| ^1
| warning and 1 error generated.
| ./rewrite-int.h:44:21: note: expanded from macro 'calloc'
| #define calloc(x,y) ber_memcalloc(x,y)
| ^
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libraries/librewrite/rewrite-int.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libraries/librewrite/rewrite-int.h b/libraries/librewrite/rewrite-int.h
index 4481dd3..5ec226d 100644
--- a/libraries/librewrite/rewrite-int.h
+++ b/libraries/librewrite/rewrite-int.h
@@ -40,6 +40,11 @@
#include <rewrite.h>
+#ifndef NO_THREADS
+#define USE_REWRITE_LDAP_PVT_THREADS
+#include <ldap_pvt_thread.h>
+#endif
+
#define malloc(x) ber_memalloc(x)
#define calloc(x,y) ber_memcalloc(x,y)
#define realloc(x,y) ber_memrealloc(x,y)
@@ -47,11 +52,6 @@
#undef strdup
#define strdup(x) ber_strdup(x)
-#ifndef NO_THREADS
-#define USE_REWRITE_LDAP_PVT_THREADS
-#include <ldap_pvt_thread.h>
-#endif
-
/*
* For details, see RATIONALE.
*/
--
2.35.1