blob: bcd1525b670f9d2e8e2c2cc79a8e2338dbc62a29 [file] [log] [blame]
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00001From 79381ab335898c9184e22dd25b544adefa9bf6c5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Feb 2022 16:26:57 -0800
4Subject: [PATCH] librewrite: include ldap_pvt_thread.h before redefining
5 calloc
6
7This helps compiling with musl, where sched.h is included by
8ldap_pvt_thread.h which provides prototype for calloc() and conflicts
9
10/usr/include/sched.h:84:7: error: conflicting types for 'ber_memcalloc'
11| void *calloc(size_t, size_t);
12| ^1
13| warning and 1 error generated.
14| ./rewrite-int.h:44:21: note: expanded from macro 'calloc'
15| #define calloc(x,y) ber_memcalloc(x,y)
16| ^
17
18Upstream-Status: Pending
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
21 libraries/librewrite/rewrite-int.h | 10 +++++-----
22 1 file changed, 5 insertions(+), 5 deletions(-)
23
24diff --git a/libraries/librewrite/rewrite-int.h b/libraries/librewrite/rewrite-int.h
25index 4481dd3..5ec226d 100644
26--- a/libraries/librewrite/rewrite-int.h
27+++ b/libraries/librewrite/rewrite-int.h
28@@ -40,6 +40,11 @@
29
30 #include <rewrite.h>
31
32+#ifndef NO_THREADS
33+#define USE_REWRITE_LDAP_PVT_THREADS
34+#include <ldap_pvt_thread.h>
35+#endif
36+
37 #define malloc(x) ber_memalloc(x)
38 #define calloc(x,y) ber_memcalloc(x,y)
39 #define realloc(x,y) ber_memrealloc(x,y)
40@@ -47,11 +52,6 @@
41 #undef strdup
42 #define strdup(x) ber_strdup(x)
43
44-#ifndef NO_THREADS
45-#define USE_REWRITE_LDAP_PVT_THREADS
46-#include <ldap_pvt_thread.h>
47-#endif
48-
49 /*
50 * For details, see RATIONALE.
51 */
52--
532.35.1
54