< prev index next >

src/java.base/share/native/libzip/zip_util.c

Print this page

1099     free(ze->name);
1100     free(ze->extra);
1101     free(ze->comment);
1102     free(ze);
1103     ze = NULL;
1104 
1105  Finally:
1106 #ifdef USE_MMAP
1107     if (!zip->usemmap)
1108 #endif
1109         if (cen != NULL && accessHint == ACCESS_RANDOM) free(cen);
1110     return ze;
1111 }
1112 
1113 /*
1114  * Free the given jzentry.
1115  * In fact we maintain a one-entry cache of the most recently used
1116  * jzentry for each zip.  This optimizes a common access pattern.
1117  */
1118 
1119 void
1120 ZIP_FreeEntry(jzfile *jz, jzentry *ze)
1121 {
1122     jzentry *last;
1123     ZIP_Lock(jz);
1124     last = jz->cache;
1125     jz->cache = ze;
1126     ZIP_Unlock(jz);
1127     if (last != NULL) {
1128         /* Free the previously cached jzentry */
1129         free(last->name);
1130         free(last->extra);
1131         free(last->comment);
1132         free(last);
1133     }
1134 }
1135 
1136 /*
1137  * Returns the zip entry corresponding to the specified name, or
1138  * NULL if not found.
1139  */

1099     free(ze->name);
1100     free(ze->extra);
1101     free(ze->comment);
1102     free(ze);
1103     ze = NULL;
1104 
1105  Finally:
1106 #ifdef USE_MMAP
1107     if (!zip->usemmap)
1108 #endif
1109         if (cen != NULL && accessHint == ACCESS_RANDOM) free(cen);
1110     return ze;
1111 }
1112 
1113 /*
1114  * Free the given jzentry.
1115  * In fact we maintain a one-entry cache of the most recently used
1116  * jzentry for each zip.  This optimizes a common access pattern.
1117  */
1118 
1119 JNIEXPORT void
1120 ZIP_FreeEntry(jzfile *jz, jzentry *ze)
1121 {
1122     jzentry *last;
1123     ZIP_Lock(jz);
1124     last = jz->cache;
1125     jz->cache = ze;
1126     ZIP_Unlock(jz);
1127     if (last != NULL) {
1128         /* Free the previously cached jzentry */
1129         free(last->name);
1130         free(last->extra);
1131         free(last->comment);
1132         free(last);
1133     }
1134 }
1135 
1136 /*
1137  * Returns the zip entry corresponding to the specified name, or
1138  * NULL if not found.
1139  */
< prev index next >