From bfc376060ac4525495d2edc8a08b922a9176418b Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Sat, 25 May 2002 02:23:17 +0000 Subject: [PATCH] Reduce build-time per-system dependencies and krb5.h namespace intrusions * krb5.hin: Don't include profile.h. Do include limits.h. (krb5_int16, krb5_ui_2, krb5_int32, krb5_ui_4): Conditionalize on the values of INT_MAX, LONG_MAX and SHRT_MAX. (VALID_INT_BITS, VALID_UINT_BITS, SALT_TYPE_AFS_LENGTH, SALT_TYPE_NO_LENGTH): Define in terms of INT_MAX and UINT_MAX. (struct _profile_t): Declare forward. (krb5_get_profile): Use struct _profile_t instead of profile_t in declaration. (krb5_ui_1): Delete. * Makefile.in (krb5.h): Don't put SIZEOF macros into output. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14451 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/ChangeLog | 15 +++++++++++++ src/include/Makefile.in | 4 +--- src/include/krb5.hin | 47 ++++++++++++++++------------------------- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/src/include/ChangeLog b/src/include/ChangeLog index 1abad7c80..e64a3fb26 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,18 @@ +2002-05-24 Ken Raeburn + + Reduce build-time per-system dependencies and krb5.h namespace + intrusions: + * krb5.hin: Don't include profile.h. Do include limits.h. + (krb5_int16, krb5_ui_2, krb5_int32, krb5_ui_4): Conditionalize on + the values of INT_MAX, LONG_MAX and SHRT_MAX. + (VALID_INT_BITS, VALID_UINT_BITS, SALT_TYPE_AFS_LENGTH, + SALT_TYPE_NO_LENGTH): Define in terms of INT_MAX and UINT_MAX. + (struct _profile_t): Declare forward. + (krb5_get_profile): Use struct _profile_t instead of profile_t in + declaration. + (krb5_ui_1): Delete. + * Makefile.in (krb5.h): Don't put SIZEOF macros into output. + 2002-04-25 Ken Raeburn * fake-addrinfo.h (GET_HOST_BY_NAME, GET_HOST_BY_ADDR) diff --git a/src/include/Makefile.in b/src/include/Makefile.in index d0647e653..2f6972848 100644 --- a/src/include/Makefile.in +++ b/src/include/Makefile.in @@ -24,10 +24,8 @@ $(srcdir)/krb5/autoconf.stmp: $(srcdir)/configure.in $(SRCTOP)/acconfig.h krb5.h: krb5/autoconf.h $(srcdir)/krb5.hin krb5_err.h kdb5_err.h kv5m_err.h \ asn1_err.h - echo "/* This is the prologue to krb5.h */" > krb5.h - echo "/* Unfortunately some of these defines are compiler dependent */" >> krb5.h + echo "/* This file is generated, please don't edit it directly. */" > krb5.h grep SIZEOF krb5/autoconf.h >> krb5.h - echo "/* End of prologue section */" >> krb5.h cat $(srcdir)/krb5.hin krb5_err.h kdb5_err.h kv5m_err.h \ asn1_err.h >> krb5.h diff --git a/src/include/krb5.hin b/src/include/krb5.hin index 523cb4491..704555c51 100644 --- a/src/include/krb5.hin +++ b/src/include/krb5.hin @@ -68,10 +68,6 @@ #endif #endif -#if defined(_WIN32) || defined(macintosh) -#include -#endif - #ifndef KRB5_CONFIG__ #ifndef KRB5_CALLCONV #define KRB5_CALLCONV @@ -86,16 +82,7 @@ #define KRB5_OLD_CRYPTO #include - -/* - * begin "error_def.h" - */ - -#include - -/* - * end "error_def.h" - */ +#include /* for *_MAX */ #if defined(__cplusplus) && !defined(KRB5INT_BEGIN_DECLS) #define KRB5INT_BEGIN_DECLS extern "C" { @@ -107,6 +94,10 @@ KRB5INT_BEGIN_DECLS +/* from profile.h */ +struct _profile_t; +/* typedef struct _profile_t *profile_t; */ + /* * begin wordsize.h */ @@ -116,35 +107,33 @@ KRB5INT_BEGIN_DECLS */ typedef unsigned char krb5_octet; -typedef unsigned char krb5_ui_1; -#if (SIZEOF_INT == 2) +#if INT_MAX == 0x7fff typedef int krb5_int16; typedef unsigned int krb5_ui_2; -#define VALID_INT_BITS 0x7fff -#define VALID_UINT_BITS 0xffff -#elif (SIZEOF_SHORT == 2) +#elif SHRT_MAX == 0x7fff typedef short krb5_int16; typedef unsigned short krb5_ui_2; #else - ?==error: undefined 16 bit type +#error undefined 16 bit type #endif -#if (SIZEOF_INT == 4) +#if INT_MAX == 0x7fffffffL typedef int krb5_int32; typedef unsigned int krb5_ui_4; -#define VALID_INT_BITS 0x7fffffff -#define VALID_UINT_BITS 0xffffffff -#elif (SIZEOF_LONG == 4) +#elif LONG_MAX == 0x7fffffffL typedef long krb5_int32; typedef unsigned long krb5_ui_4; -#elif (SIZEOF_SHORT == 4) +#elif SHRT_MAX == 0x7fffffffL typedef short krb5_int32; typedef unsigned short krb5_ui_4; #else - ?== error: undefined 32 bit type +#error: undefined 32 bit type #endif +#define VALID_INT_BITS INT_MAX +#define VALID_UINT_BITS UINT_MAX + #define KRB5_INT32_MAX 2147483647 /* this strange form is necessary since - is a unary operator, not a sign indicator */ @@ -204,8 +193,8 @@ typedef struct _krb5_data { * We also overload for an unset salt type length - which is also -1, but * hey, why not.... */ -#define SALT_TYPE_AFS_LENGTH VALID_UINT_BITS -#define SALT_TYPE_NO_LENGTH VALID_UINT_BITS +#define SALT_TYPE_AFS_LENGTH UINT_MAX +#define SALT_TYPE_NO_LENGTH UINT_MAX typedef void * krb5_pointer; typedef void const * krb5_const_pointer; @@ -1836,7 +1825,7 @@ void KRB5_CALLCONV krb5_free_config_files krb5_error_code KRB5_CALLCONV krb5_get_profile - (krb5_context, profile_t *); + (krb5_context, struct _profile_t * /* profile_t */ *); #if KRB5_PRIVATE krb5_error_code krb5_send_tgs -- 2.26.2