am 99e084ca: Merge "Remove dead/unused code and realign some of the comments to make it more cleaner and easier to read"
* commit '99e084ca8012bc7af52ae2fb9e72ab7180177daf': Remove dead/unused code and realign some of the comments to make it more cleaner and easier to read
This commit is contained in:
+2
-2
@@ -85,7 +85,7 @@ dirCreateHierarchy(const char *path, int mode,
|
|||||||
c--;
|
c--;
|
||||||
}
|
}
|
||||||
if (c == cpath) {
|
if (c == cpath) {
|
||||||
//xxx test this path
|
//xxx test this path
|
||||||
/* No directory component. Act like the path was empty.
|
/* No directory component. Act like the path was empty.
|
||||||
*/
|
*/
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
@@ -206,7 +206,7 @@ dirUnlinkHierarchy(const char *path)
|
|||||||
/* recurse over components */
|
/* recurse over components */
|
||||||
errno = 0;
|
errno = 0;
|
||||||
while ((de = readdir(dir)) != NULL) {
|
while ((de = readdir(dir)) != NULL) {
|
||||||
//TODO: don't blow the stack
|
//TODO: don't blow the stack
|
||||||
char dn[PATH_MAX];
|
char dn[PATH_MAX];
|
||||||
if (!strcmp(de->d_name, "..") || !strcmp(de->d_name, ".")) {
|
if (!strcmp(de->d_name, "..") || !strcmp(de->d_name, ".")) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -140,7 +140,6 @@ static bool resizeHash(HashTable* pHashTable, int newSize)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
assert(countTombStones(pHashTable) == pHashTable->numDeadEntries);
|
assert(countTombStones(pHashTable) == pHashTable->numDeadEntries);
|
||||||
//LOGI("before: dead=%d\n", pHashTable->numDeadEntries);
|
|
||||||
|
|
||||||
pNewEntries = (HashEntry*) calloc(newSize, sizeof(HashTable));
|
pNewEntries = (HashEntry*) calloc(newSize, sizeof(HashTable));
|
||||||
if (pNewEntries == NULL)
|
if (pNewEntries == NULL)
|
||||||
@@ -196,7 +195,6 @@ void* mzHashTableLookup(HashTable* pHashTable, unsigned int itemHash, void* item
|
|||||||
(*cmpFunc)(pEntry->data, item) == 0)
|
(*cmpFunc)(pEntry->data, item) == 0)
|
||||||
{
|
{
|
||||||
/* match */
|
/* match */
|
||||||
//LOGD("+++ match on entry %d\n", pEntry - pHashTable->pEntries);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,8 +204,6 @@ void* mzHashTableLookup(HashTable* pHashTable, unsigned int itemHash, void* item
|
|||||||
break; /* edge case - single-entry table */
|
break; /* edge case - single-entry table */
|
||||||
pEntry = pHashTable->pEntries;
|
pEntry = pHashTable->pEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
//LOGI("+++ look probing %d...\n", pEntry - pHashTable->pEntries);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pEntry->data == NULL) {
|
if (pEntry->data == NULL) {
|
||||||
@@ -228,10 +224,6 @@ void* mzHashTableLookup(HashTable* pHashTable, unsigned int itemHash, void* item
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
/* note "pEntry" is now invalid */
|
/* note "pEntry" is now invalid */
|
||||||
} else {
|
|
||||||
//LOGW("okay %d/%d/%d\n",
|
|
||||||
// pHashTable->numEntries, pHashTable->tableSize,
|
|
||||||
// (pHashTable->tableSize * LOAD_NUMER) / LOAD_DENOM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* full table is bad -- search for nonexistent never halts */
|
/* full table is bad -- search for nonexistent never halts */
|
||||||
@@ -264,7 +256,6 @@ bool mzHashTableRemove(HashTable* pHashTable, unsigned int itemHash, void* item)
|
|||||||
pEnd = &pHashTable->pEntries[pHashTable->tableSize];
|
pEnd = &pHashTable->pEntries[pHashTable->tableSize];
|
||||||
while (pEntry->data != NULL) {
|
while (pEntry->data != NULL) {
|
||||||
if (pEntry->data == item) {
|
if (pEntry->data == item) {
|
||||||
//LOGI("+++ stepping on entry %d\n", pEntry - pHashTable->pEntries);
|
|
||||||
pEntry->data = HASH_TOMBSTONE;
|
pEntry->data = HASH_TOMBSTONE;
|
||||||
pHashTable->numEntries--;
|
pHashTable->numEntries--;
|
||||||
pHashTable->numDeadEntries++;
|
pHashTable->numDeadEntries++;
|
||||||
@@ -277,8 +268,6 @@ bool mzHashTableRemove(HashTable* pHashTable, unsigned int itemHash, void* item)
|
|||||||
break; /* edge case - single-entry table */
|
break; /* edge case - single-entry table */
|
||||||
pEntry = pHashTable->pEntries;
|
pEntry = pHashTable->pEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
//LOGI("+++ del probing %d...\n", pEntry - pHashTable->pEntries);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+6
-10
@@ -327,10 +327,6 @@ static bool parseZipArchive(ZipArchive* pArchive)
|
|||||||
#else
|
#else
|
||||||
pEntry = &pArchive->pEntries[i];
|
pEntry = &pArchive->pEntries[i];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//LOGI("%d: localHdr=%d fnl=%d el=%d cl=%d\n",
|
|
||||||
// i, localHdrOffset, fileNameLen, extraLen, commentLen);
|
|
||||||
|
|
||||||
pEntry->fileNameLen = fileNameLen;
|
pEntry->fileNameLen = fileNameLen;
|
||||||
pEntry->fileName = fileName;
|
pEntry->fileName = fileName;
|
||||||
|
|
||||||
@@ -923,8 +919,8 @@ bool mzExtractRecursive(const ZipArchive *pArchive,
|
|||||||
|
|
||||||
/* Walk through the entries and extract anything whose path begins
|
/* Walk through the entries and extract anything whose path begins
|
||||||
* with zpath.
|
* with zpath.
|
||||||
//TODO: since the entries are sorted, binary search for the first match
|
//TODO: since the entries are sorted, binary search for the first match
|
||||||
// and stop after the first non-match.
|
// and stop after the first non-match.
|
||||||
*/
|
*/
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
bool seenMatch = false;
|
bool seenMatch = false;
|
||||||
@@ -933,10 +929,10 @@ bool mzExtractRecursive(const ZipArchive *pArchive,
|
|||||||
for (i = 0; i < pArchive->numEntries; i++) {
|
for (i = 0; i < pArchive->numEntries; i++) {
|
||||||
ZipEntry *pEntry = pArchive->pEntries + i;
|
ZipEntry *pEntry = pArchive->pEntries + i;
|
||||||
if (pEntry->fileNameLen < zipDirLen) {
|
if (pEntry->fileNameLen < zipDirLen) {
|
||||||
//TODO: look out for a single empty directory entry that matches zpath, but
|
//TODO: look out for a single empty directory entry that matches zpath, but
|
||||||
// missing the trailing slash. Most zip files seem to include
|
// missing the trailing slash. Most zip files seem to include
|
||||||
// the trailing slash, but I think it's legal to leave it off.
|
// the trailing slash, but I think it's legal to leave it off.
|
||||||
// e.g., zpath "a/b/", entry "a/b", with no children of the entry.
|
// e.g., zpath "a/b/", entry "a/b", with no children of the entry.
|
||||||
/* No chance of matching.
|
/* No chance of matching.
|
||||||
*/
|
*/
|
||||||
#if SORT_ENTRIES
|
#if SORT_ENTRIES
|
||||||
|
|||||||
Reference in New Issue
Block a user