IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 19, 2004, 9:11:05 AM (22 years ago)
Author:
rhl
Message:

1/ Correct check for reallocating comp->subcomp
2/ Insert new subcomponent in the right place
3/ Move test code to tst_trace.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/src/Utils/trace.c

    r177 r262  
    134134     * No match; add cpt0 to this level. Ensure that subcomp is sorted
    135135     */
    136     if (comp->n == comp->dimen) {
     136    if (comp->n >= comp->dimen - 1) {
    137137        comp->dimen += 5;
    138         comp->subcomp = psRealloc(comp->subcomp, comp->dimen);
     138        comp->subcomp = psRealloc(comp->subcomp, comp->dimen*sizeof(Component *));
    139139    }
    140140
     
    146146                comp->subcomp[j] = comp->subcomp[j - 1];
    147147            }
     148            break;
    148149        }
    149150    }
     
    300301    }
    301302}
    302 
    303 /*****************************************************************************/
    304 #if 0                                   // testing
    305 
    306 int main(void)
    307 {
    308     psSetLogFormat("NM");               // suppress some of the psLogMsg verbosity
    309    
    310 #if 0
    311     psSetTraceLevel("", 10);
    312 #else
    313     psSetTraceLevel("aaa.bbb.ccc.ddd", 9);
    314     psSetTraceLevel("aaa.bbb.ccc", 3);
    315     psSetTraceLevel("aaa.bbb.ddd", 4);
    316     psSetTraceLevel("aaa.BBB", 2);
    317     psSetTraceLevel("BBB", 2);
    318     psSetTraceLevel("BBB.XXX.YYY.ZZZ", 5);
    319     psSetTraceLevel("aaa.bbb", 2);
    320     psSetTraceLevel("aaa.bbb.ccc", 9);
    321     psSetTraceLevel("aaa", 1);
    322 #endif
    323    
    324     psPrintTraceLevels();
    325     printf("\n");
    326 
    327     psTrace("aaa.bbb.ddd", 2, "(aaa.bbb.ddd) Hello %s\n", "world");
    328     psTrace("aaa", 2, "aaa\n");
    329     psTrace("", 2, "\"\"\n");
    330     psTrace("aaa.bbb", 2, "aaa.bbb\n");
    331     psTrace("aaa.bbb.ddd", 2, "aaa.bbb.ddd\n");
    332     psTrace("aaa.bbb.ddd", 4, "aaa.bbb.ddd\n");
    333     psTrace("aaa.bbb.ddd", 2, "aaa.bbb.ddd\n");
    334     psTrace("aaa.bbb.ccc", 1, "aaa.bbb.ccc\n");
    335     psTrace("aaa.bbb.eee", 2, "aaa.bbb.eee\n");
    336 
    337     psTraceReset();
    338     fprintf(stderr,"Checking for memory leaks:\n");
    339     psMemCheckLeaks(0, NULL, stderr);
    340    
    341 
    342     return 0;
    343 }
    344 #endif
Note: See TracChangeset for help on using the changeset viewer.