prof_init.c (profile_abandon): New function which frees the profile
authorTheodore Tso <tytso@mit.edu>
Wed, 14 Apr 1999 15:10:43 +0000 (15:10 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 14 Apr 1999 15:10:43 +0000 (15:10 +0000)
handle and throwing away any changes that might have been made before
they are flushed to disk.

prof_file.c (profile_close_file): Move functionality of freeing the
profile file to the new function profile_free_file().

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

src/util/profile/ChangeLog
src/util/profile/prof_file.c
src/util/profile/prof_init.c
src/util/profile/prof_int.h
src/util/profile/profile.hin

index a9bacd304b7c3ed664f2843a071fe45333c3b816..4c3056aab7c18d6773ecbc16591be6abdb6388e5 100644 (file)
@@ -1,3 +1,12 @@
+1999-04-14    <tytso@rsts-11.mit.edu>
+
+       * prof_init.c (profile_abandon): New function which frees the
+               profile handle and throwing away any changes that might
+               have been made before they are flushed to disk.
+
+       * prof_file.c (profile_close_file): Move functionality of freeing
+               the profile file to the new function profile_free_file().
+
 Mon Mar 15 16:03:34 1999  Tom Yu  <tlyu@mit.edu>
 
        * profile.hin: Fix GSS_DLLIMP.
index fe9137afd6977aa7c1254befcf35ae669bc4f7a2..0f1ac658fd20cb0fad7887343c200d24ad2a5dbc 100644 (file)
@@ -211,14 +211,9 @@ errout:
 }
 
 
-errcode_t profile_close_file(prf)
+void profile_free_file(prf)
        prf_file_t prf;
 {
-       errcode_t       retval;
-       
-       retval = profile_flush_file(prf);
-       if (retval)
-               return retval;
        if (prf->filename)
                free(prf->filename);
        if (prf->root)
@@ -228,6 +223,18 @@ errcode_t profile_close_file(prf)
        prf->magic = 0;
        free(prf);
 
+       return;
+}
+
+errcode_t profile_close_file(prf)
+       prf_file_t prf;
+{
+       errcode_t       retval;
+       
+       retval = profile_flush_file(prf);
+       if (retval)
+               return retval;
+       profile_free_file(prf);
        return 0;
 }
 
index 6a076612fbd49b03cca8ced87c01472eee352dde..1411e4f4549028338d212924413416a5e5b92a47 100644 (file)
@@ -132,6 +132,19 @@ profile_flush(profile)
        return 0;
 }
 
+KRB5_DLLIMP void KRB5_CALLCONV
+profile_abandon(profile)
+       profile_t       profile;
+{
+       prf_file_t      p, next;
+
+       for (p = profile->first_file; p; p = next) {
+               next = p->next;
+               profile_free_file(p);
+       }
+       profile->magic = 0;
+       free(profile);
+}
 
 KRB5_DLLIMP void KRB5_CALLCONV
 profile_release(profile)
index 312b78e2b18761cf9a039d66d64bd7d399321d13..dea4fde84304cac1493550712cece49c0de0764f 100644 (file)
@@ -172,6 +172,9 @@ errcode_t profile_update_file
 errcode_t profile_flush_file
        PROTOTYPE ((prf_file_t profile));
 
+void profile_free_file
+       PROTOTYPE ((prf_file_t profile));
+
 errcode_t profile_close_file
        PROTOTYPE ((prf_file_t profile));
 
index ee32f90a0781f7d3d3364e9d02723650b1e1fb83..98f7d02150c474a2ca1997765bb5e82e5e129e8f 100644 (file)
@@ -45,6 +45,9 @@ KRB5_DLLIMP long KRB5_CALLCONV profile_init_path
 KRB5_DLLIMP long KRB5_CALLCONV profile_flush
        PROTOTYPE ((profile_t profile));
 
+KRB5_DLLIMP void KRB5_CALLCONV profile_abandon
+       PROTOTYPE ((profile_t profile));
+
 KRB5_DLLIMP void KRB5_CALLCONV profile_release
        PROTOTYPE ((profile_t profile));