From c50125f6ef127db020bc0fcfdca8ed0b24e4f018 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 31 Mar 2006 23:28:18 +0000 Subject: r14844: Support a stdbool.h replacement in lib/replace/ (This used to be commit bccfddcafa1fdb56392e2301bbd404964ad9f7c3) --- source4/build/m4/check_types.m4 | 4 ---- source4/build/m4/rewrite.m4 | 2 +- source4/client/cifsdd.c | 2 +- source4/include/core.h | 5 ++--- source4/include/includes.h | 8 -------- source4/lib/appweb/mpr/miniMpr.h | 2 ++ source4/lib/replace/README | 1 + source4/lib/replace/config.m4 | 3 +++ source4/lib/replace/replace.h | 17 +++++++++++++++++ source4/param/param.h | 2 ++ 10 files changed, 29 insertions(+), 17 deletions(-) diff --git a/source4/build/m4/check_types.m4 b/source4/build/m4/check_types.m4 index 88ccc7859c..41667bd431 100644 --- a/source4/build/m4/check_types.m4 +++ b/source4/build/m4/check_types.m4 @@ -15,8 +15,6 @@ AC_C_BIGENDIAN AC_HEADER_STDC -AC_CHECK_HEADERS(stdbool.h) - AC_CHECK_SIZEOF(short,cross) AC_CHECK_SIZEOF(int,cross) AC_CHECK_SIZEOF(long,cross) @@ -27,5 +25,3 @@ fi if test $ac_cv_sizeof_long_long -lt 8;then AC_MSG_ERROR([Sorry we need sizeof(long long) >= 8]) fi -AC_CHECK_TYPE(_Bool) - diff --git a/source4/build/m4/rewrite.m4 b/source4/build/m4/rewrite.m4 index 2e94fb215e..fb7ca0f9f7 100644 --- a/source4/build/m4/rewrite.m4 +++ b/source4/build/m4/rewrite.m4 @@ -58,7 +58,7 @@ AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/i AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h) AC_CHECK_HEADERS(sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h) AC_CHECK_HEADERS(fnmatch.h pwd.h sys/termio.h sys/time.h sys/statfs.h sys/statvfs.h stdarg.h) -AC_CHECK_HEADERS(stdint.h inttypes.h locale.h shadow.h) +AC_CHECK_HEADERS(locale.h shadow.h) AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h) AC_CHECK_HEADERS(sys/capability.h sys/acl.h) diff --git a/source4/client/cifsdd.c b/source4/client/cifsdd.c index a168a91946..c7e054c364 100644 --- a/source4/client/cifsdd.c +++ b/source4/client/cifsdd.c @@ -195,7 +195,7 @@ void set_arg_val(const char * name, ...) arg->arg_val.nval = va_arg(ap, uint64_t); break; case ARG_BOOL: - arg->arg_val.bval = va_arg(ap, BOOL); + arg->arg_val.bval = va_arg(ap, int); break; case ARG_PATHNAME: arg->arg_val.pval = va_arg(ap, char *); diff --git a/source4/include/core.h b/source4/include/core.h index cb9da4dd87..6ca276bf0e 100644 --- a/source4/include/core.h +++ b/source4/include/core.h @@ -26,11 +26,10 @@ #include "libcli/util/nt_status.h" +typedef int BOOL; + #define False (0) #define True (1) -#define Auto (2) - -typedef int BOOL; /* used to hold an arbitrary blob of data */ typedef struct datablob { diff --git a/source4/include/includes.h b/source4/include/includes.h index b8aebf2f14..a79a48f377 100644 --- a/source4/include/includes.h +++ b/source4/include/includes.h @@ -74,14 +74,6 @@ _PUBLIC_ void smb_panic(const char *why) NORETURN_ATTRIBUTE; #include #include -#ifdef HAVE_STDINT_H -#include -#endif - -#ifdef HAVE_INTTYPES_H -#include -#endif - #ifdef HAVE_STRING_H #include #endif diff --git a/source4/lib/appweb/mpr/miniMpr.h b/source4/lib/appweb/mpr/miniMpr.h index d92e50fe89..30d2103ba8 100644 --- a/source4/lib/appweb/mpr/miniMpr.h +++ b/source4/lib/appweb/mpr/miniMpr.h @@ -185,8 +185,10 @@ typedef char* MprStr; #ifndef __cplusplus typedef unsigned char uchar; +#ifndef __bool_true_false_are_defined typedef int bool; #endif +#endif /* * Porters: put other operating system type defines here diff --git a/source4/lib/replace/README b/source4/lib/replace/README index 19364e2faa..a789f66b81 100644 --- a/source4/lib/replace/README +++ b/source4/lib/replace/README @@ -52,6 +52,7 @@ getpass readline (the library) Types: +bool socklen_t u_int{8,16,32}_t uint_t diff --git a/source4/lib/replace/config.m4 b/source4/lib/replace/config.m4 index 873e7b2bca..3c11ac1476 100644 --- a/source4/lib/replace/config.m4 +++ b/source4/lib/replace/config.m4 @@ -1,3 +1,4 @@ +AC_CHECK_HEADERS([stdint.h inttypes.h]) AC_CHECK_TYPE(uint_t, unsigned int) AC_CHECK_TYPE(int8_t, signed char) AC_CHECK_TYPE(uint8_t, unsigned char) @@ -127,5 +128,7 @@ LIBS="$SAVE_LIBS" AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],, [AC_MSG_ERROR([Required function not found])]) +AC_CHECK_HEADERS(stdbool.h) + sinclude(lib/replace/readline.m4) sinclude(lib/replace/getpass.m4) diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h index 24876ffd4e..20b73e5b84 100644 --- a/source4/lib/replace/replace.h +++ b/source4/lib/replace/replace.h @@ -35,6 +35,14 @@ #define QSORT_CAST (int (*)(const void *, const void *)) #endif +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_INTTYPES_H +#include +#endif + #ifndef HAVE_STRERROR extern char *sys_errlist[]; #define strerror(i) sys_errlist[i] @@ -194,4 +202,13 @@ int rep_mkstemp(char *temp); #define INT32_MAX _TYPE_MAXIMUM(int32_t) #endif +#ifdef HAVE_STDBOOL_H +#include +#else +#define __bool_true_false_are_defined +typedef bool int; +#define false (0) +#define true (1) +#endif + #endif diff --git a/source4/param/param.h b/source4/param/param.h index 923b06eb86..dad5f12b15 100644 --- a/source4/param/param.h +++ b/source4/param/param.h @@ -41,6 +41,8 @@ struct param_section { struct param_context; struct smbsrv_connection; +#define Auto (2) + #include "param/proto.h" #endif /* _PARAM_H */ -- cgit