Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame^] | 1 | From 79381ab335898c9184e22dd25b544adefa9bf6c5 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Mon, 7 Feb 2022 16:26:57 -0800 |
| 4 | Subject: [PATCH] librewrite: include ldap_pvt_thread.h before redefining |
| 5 | calloc |
| 6 | |
| 7 | This helps compiling with musl, where sched.h is included by |
| 8 | ldap_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 | |
| 18 | Upstream-Status: Pending |
| 19 | Signed-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 | |
| 24 | diff --git a/libraries/librewrite/rewrite-int.h b/libraries/librewrite/rewrite-int.h |
| 25 | index 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 | -- |
| 53 | 2.35.1 |
| 54 | |