Changeset 1073 for trunk/psLib/test/sysUtils/tst_psHash03.c
- Timestamp:
- Jun 23, 2004, 1:00:17 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/sysUtils/tst_psHash03.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/sysUtils/tst_psHash03.c
r1022 r1073 19 19 } 20 20 ID; 21 static void IdFree(ID *id); 21 22 22 23 // NOTE: This is my own little routine I used in debugging a memory … … 48 49 49 50 id = psAlloc(sizeof(ID)); 51 p_psMemSetDeallocator(id,(psFreeFcn)IdFree); 50 52 51 53 id->name = psStringCopy(name); … … 58 60 imGlobal++; 59 61 psFree(id->name); 60 psFree(id);61 62 } 62 63 … … 82 83 i = 0; 83 84 while (myKeys[i] != NULL) { 84 psHashInsert(myHashTable, myKeys[i], IdAlloc(myData[i]), 85 (void (*)(void *))IdFree); 85 psHashInsert(myHashTable, myKeys[i], IdAlloc(myData[i])); 86 86 i++; 87 87 } … … 101 101 i = 0; 102 102 while (myKeys[i] != NULL) { 103 id = psHashRemove(myHashTable, myKeys[i] , (void (*)(void *))IdFree);103 id = psHashRemove(myHashTable, myKeys[i]); 104 104 // The psHashRemove() procedure removes the entry from the hash 105 105 // table, but does not delete the data. The following is necessary 106 106 // to delete the data as well (which is returned from the call). 107 IdFree(id);107 psFree(id); 108 108 id = psHashLookup(myHashTable, myKeys[i]); 109 109 if (id != NULL) { … … 119 119 testStatus); 120 120 121 ps HashFree(myHashTable, (void (*)(void *))IdFree);122 memLeaks = psMemCheckLeaks(currentId,NULL, NULL);121 psFree(myHashTable); 122 memLeaks = psMemCheckLeaks(currentId,NULL,stdout); 123 123 if (0 != memLeaks) { 124 124 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
Note:
See TracChangeset
for help on using the changeset viewer.
