Changeset 1073 for trunk/psLib/test/sysUtils/tst_psHash04.c
- Timestamp:
- Jun 23, 2004, 1:00:17 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/sysUtils/tst_psHash04.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/sysUtils/tst_psHash04.c
r929 r1073 14 14 } 15 15 ID; 16 static void IdFree(ID *id); 17 16 18 static ID *IdAlloc(const char *name) 17 19 { 18 20 ID *id = psAlloc(sizeof(ID)); 21 p_psMemSetDeallocator(id,(psFreeFcn)IdFree); 22 19 23 id->name = psStringCopy(name); 20 24 … … 26 30 imGlobal++; 27 31 psFree(id->name); 28 psFree(id);29 32 } 30 33 … … 40 43 psList *myLinkList = NULL; 41 44 psListElem *tmp = NULL; 45 ID* id = NULL; 42 46 43 47 printPositiveTestHeader(stdout, … … 48 52 i = 0; 49 53 while (myKeys[i] != NULL) { 50 psHashInsert(myHashTable, myKeys[i], IdAlloc(myData[i]), 51 (void (*)(void *))IdFree); 54 id = IdAlloc(myData[i]); 55 psHashInsert(myHashTable, myKeys[i], id); 56 psFree(id); 52 57 i++; 53 58 } … … 59 64 } 60 65 61 ps ListFree(myLinkList, NULL);66 psFree(myLinkList); 62 67 63 68 printFooter(stdout, … … 66 71 testStatus); 67 72 68 ps HashFree(myHashTable, (void (*)(void *))IdFree);73 psFree(myHashTable); 69 74 70 memLeaks = psMemCheckLeaks(currentId,NULL, NULL);75 memLeaks = psMemCheckLeaks(currentId,NULL,stderr); 71 76 if (0 != memLeaks) { 72 77 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
Note:
See TracChangeset
for help on using the changeset viewer.
