Changeset 177
- Timestamp:
- Mar 9, 2004, 3:04:39 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/src/Utils/trace.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/src/Utils/trace.c
r141 r177 41 41 /*****************************************************************************/ 42 42 43 static Component *component New(const char *name,44 int level)43 static Component *componentAlloc(const char *name, 44 int level) 45 45 { 46 46 Component *comp = psAlloc(sizeof(Component)); … … 54 54 } 55 55 56 static void component Del(Component *comp)56 static void componentFree(Component *comp) 57 57 { 58 58 if (comp == NULL) { return; } 59 59 60 60 if (comp->subcomp != NULL) { 61 for (int i = 0; comp->subcomp[i] != NULL; i++) {62 component Del(comp->subcomp[i]);61 for (int i = 0; i < comp->n; i++) { 62 componentFree(comp->subcomp[i]); 63 63 } 64 64 psFree(comp->subcomp); 65 65 } 66 66 67 psFree((char *)comp->name); 67 68 psFree(comp); 68 69 } … … 76 77 static void initTrace(void) { 77 78 if (croot == NULL) { 78 croot = componentNew("", UNKNOWN_LEVEL); 79 } 79 croot = componentAlloc("", UNKNOWN_LEVEL); 80 } 81 } 82 83 /*****************************************************************************/ 84 /* 85 * Free the trace tree information 86 */ 87 void psTraceReset(void) 88 { 89 componentFree(croot); 90 croot = NULL; 80 91 } 81 92 … … 128 139 } 129 140 130 Component *fcpt0 = component New(cpt0, UNKNOWN_LEVEL);141 Component *fcpt0 = componentAlloc(cpt0, UNKNOWN_LEVEL); 131 142 int i; 132 143 for (i = 0; i < comp->n; i++) { … … 295 306 int main(void) 296 307 { 308 psSetLogFormat("NM"); // suppress some of the psLogMsg verbosity 309 297 310 #if 0 298 311 psSetTraceLevel("", 10); … … 322 335 psTrace("aaa.bbb.eee", 2, "aaa.bbb.eee\n"); 323 336 337 psTraceReset(); 338 fprintf(stderr,"Checking for memory leaks:\n"); 339 psMemCheckLeaks(0, NULL, stderr); 340 341 324 342 return 0; 325 343 }
Note:
See TracChangeset
for help on using the changeset viewer.
