* init_ctx.c (init_common): Delete redundant library initialization call that
authorKen Raeburn <raeburn@mit.edu>
Wed, 16 Feb 2005 19:57:15 +0000 (19:57 +0000)
committerKen Raeburn <raeburn@mit.edu>
Wed, 16 Feb 2005 19:57:15 +0000 (19:57 +0000)
was run only on UNIX.  Test assertion that krb5_ui_8 really did get a proper
64-bit type.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17103 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/ChangeLog
src/lib/krb5/krb/init_ctx.c

index c3e43123df511e5754f70c6e4e3fcfe2f46dff8f..cc0d58cd37987a2910e168a151240a6198ef32f5 100644 (file)
@@ -1,3 +1,9 @@
+2005-02-16  Ken Raeburn  <raeburn@mit.edu>
+
+       * init_ctx.c (init_common): Delete redundant library
+       initialization call that was run only on UNIX.  Test assertion
+       that krb5_ui_8 really did get a proper 64-bit type.
+
 2005-02-09  Tom Yu  <tlyu@mit.edu>
 
        * gic_pwd.c (krb5_get_init_creds_password): Fix so empty password
index c3f66105b1485c8ecf00bcfd1d03fa09cc3d7c6c..3cbf99e5b8a7dd32335aa7e81fbc59e159077d31 100644 (file)
@@ -109,6 +109,22 @@ init_common (krb5_context *context, krb5_boolean secure)
        krb5_data seed;
        int tmp;
 
+       /* Verify some assumptions.  If the assumptions hold and the
+          compiler is optimizing, this should result in no code being
+          executed.  If we're guessing "unsigned long long" instead
+          of using uint64_t, the possibility does exist that we're
+          wrong.  */
+       {
+           krb5_ui_8 i64;
+           assert(sizeof(i64) == 8);
+           i64 = 0, i64--, i64 >>= 62;
+           assert(i64 == 3);
+           i64 = 1, i64 <<= 31, i64 <<= 31, i64 <<= 1;
+           assert(i64 != 0);
+           i64 <<= 1;
+           assert(i64 == 0);
+       }
+
        retval = krb5int_initialize_library();
        if (retval)
            return retval;
@@ -128,10 +144,6 @@ init_common (krb5_context *context, krb5_boolean secure)
        retval = krb5_vercheck();
        if (retval)
                return retval;
-#else /* assume UNIX for now */
-       retval = krb5int_initialize_library ();
-       if (retval)
-           return retval;
 #endif
 
        *context = 0;