Reduce code duplication: krb5_fcc_store_int32 vs krb5_fcc_store_ui_4
authorKen Raeburn <raeburn@mit.edu>
Sat, 2 Aug 2008 06:12:09 +0000 (06:12 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 2 Aug 2008 06:12:09 +0000 (06:12 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20595 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/ccache/cc_file.c

index 134cbfbb3802cd1239a53b0ac0b98740f0e9bde8..42e9ba0f6b88c36ace6a2677bdb4837f96482bcc 100644 (file)
@@ -1033,24 +1033,7 @@ krb5_fcc_store_data(krb5_context context, krb5_ccache id, krb5_data *data)
 static krb5_error_code
 krb5_fcc_store_int32(krb5_context context, krb5_ccache id, krb5_int32 i)
 {
-    krb5_fcc_data *data = (krb5_fcc_data *)id->data;
-    unsigned char buf[4];
-
-    k5_assert_locked(&((krb5_fcc_data *) id->data)->lock);
-
-    if ((data->version == KRB5_FCC_FVNO_1) ||
-       (data->version == KRB5_FCC_FVNO_2)) 
-       return krb5_fcc_write(context, id, (char *) &i, sizeof(krb5_int32));
-    else {
-        buf[3] = (unsigned char) (i & 0xFF);
-       i >>= 8;
-        buf[2] = (unsigned char) (i & 0xFF);
-       i >>= 8;
-        buf[1] = (unsigned char) (i & 0xFF);
-       i >>= 8;
-        buf[0] = (unsigned char) (i & 0xFF);
-       return krb5_fcc_write(context, id, buf, 4);
-    }
+    return krb5_fcc_store_ui_4(context, id, (krb5_ui_4) i);
 }
 
 static krb5_error_code