1077 free(ze->name);
1078 free(ze->extra);
1079 free(ze->comment);
1080 free(ze);
1081 ze = NULL;
1082
1083 Finally:
1084 #ifdef USE_MMAP
1085 if (!zip->usemmap)
1086 #endif
1087 if (cen != NULL && accessHint == ACCESS_RANDOM) free(cen);
1088 return ze;
1089 }
1090
1091 /*
1092 * Free the given jzentry.
1093 * In fact we maintain a one-entry cache of the most recently used
1094 * jzentry for each zip. This optimizes a common access pattern.
1095 */
1096
1097 void
1098 ZIP_FreeEntry(jzfile *jz, jzentry *ze)
1099 {
1100 jzentry *last;
1101 ZIP_Lock(jz);
1102 last = jz->cache;
1103 jz->cache = ze;
1104 ZIP_Unlock(jz);
1105 if (last != NULL) {
1106 /* Free the previously cached jzentry */
1107 free(last->name);
1108 if (last->extra) free(last->extra);
1109 if (last->comment) free(last->comment);
1110 free(last);
1111 }
1112 }
1113
1114 /*
1115 * Returns the zip entry corresponding to the specified name, or
1116 * NULL if not found.
1117 */
|
1077 free(ze->name);
1078 free(ze->extra);
1079 free(ze->comment);
1080 free(ze);
1081 ze = NULL;
1082
1083 Finally:
1084 #ifdef USE_MMAP
1085 if (!zip->usemmap)
1086 #endif
1087 if (cen != NULL && accessHint == ACCESS_RANDOM) free(cen);
1088 return ze;
1089 }
1090
1091 /*
1092 * Free the given jzentry.
1093 * In fact we maintain a one-entry cache of the most recently used
1094 * jzentry for each zip. This optimizes a common access pattern.
1095 */
1096
1097 void JNICALL
1098 ZIP_FreeEntry(jzfile *jz, jzentry *ze)
1099 {
1100 jzentry *last;
1101 ZIP_Lock(jz);
1102 last = jz->cache;
1103 jz->cache = ze;
1104 ZIP_Unlock(jz);
1105 if (last != NULL) {
1106 /* Free the previously cached jzentry */
1107 free(last->name);
1108 if (last->extra) free(last->extra);
1109 if (last->comment) free(last->comment);
1110 free(last);
1111 }
1112 }
1113
1114 /*
1115 * Returns the zip entry corresponding to the specified name, or
1116 * NULL if not found.
1117 */
|