Reduce build-time per-system dependencies and krb5.h namespace intrusions
authorKen Raeburn <raeburn@mit.edu>
Sat, 25 May 2002 02:23:17 +0000 (02:23 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 25 May 2002 02:23:17 +0000 (02:23 +0000)
* 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
src/include/Makefile.in
src/include/krb5.hin

index 1abad7c8081fc846845f0ce673aaa9b070ef5cbc..e64a3fb26e9fad01589084f2bb863a559504c35f 100644 (file)
@@ -1,3 +1,18 @@
+2002-05-24  Ken Raeburn  <raeburn@mit.edu>
+
+       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  <raeburn@mit.edu>
 
        * fake-addrinfo.h (GET_HOST_BY_NAME, GET_HOST_BY_ADDR)
index d0647e653c6f77b004fbfefe0a6145f96976a304..2f6972848f4ddda4b1bbd1b4592217e6cacd48ca 100644 (file)
@@ -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
 
index 523cb44918363ac626cd46991bd989a78f80ea76..704555c51dc53b36d79dcfd287704702c231d88b 100644 (file)
 #endif
 #endif
 
-#if defined(_WIN32) || defined(macintosh)
-#include <win-mac.h>
-#endif
-
 #ifndef KRB5_CONFIG__
 #ifndef KRB5_CALLCONV
 #define KRB5_CALLCONV
 #define KRB5_OLD_CRYPTO
 
 #include <stdlib.h>
-
-/*
- * begin "error_def.h"
- */
-
-#include <profile.h>
-
-/*
- * end "error_def.h"
- */
+#include <limits.h>            /* for *_MAX */
 
 #if defined(__cplusplus) && !defined(KRB5INT_BEGIN_DECLS)
 #define KRB5INT_BEGIN_DECLS    extern "C" {
 
 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