Optimize cache in tbtree. Fix small bug in psort and move on tmalloc psortex
[tedtools.git] / psort.c
diff --git a/psort.c b/psort.c
index f61221c..e056091 100644 (file)
--- a/psort.c
+++ b/psort.c
@@ -111,9 +111,8 @@ PS_init( SORT* sobj, int buflen, compare_sort func, ffree ffunc ) {
        if ( ! func ) return -1;
        if ( buflen <= 0 ) return -1;
 
-       sobj->buf = (SORTITEM*)tmalloc( sizeof(SORTITEM)*buflen );
+       sobj->buf = (SORTITEM*)t0malloc( sizeof(SORTITEM)*buflen );
 
-       memset( (void*)sobj->buf, 0, sizeof(SORTITEM)*buflen );
        sobj->buflen = buflen;
        sobj->cmpr   = func;
        sobj->free  = ffunc;
@@ -149,7 +148,7 @@ PS_reset( SORT* sobj ) {
        int i;
 
        if ( sobj->free ) {
-               for(i=0; i<sobj->curlen; i++ );
+               for(i=0; i<sobj->curlen; i++ )
                        (*(sobj->free))( sobj->buf[i].value );
        }
        memset( (void*)sobj->buf, 0, sizeof(SORTITEM)*sobj->buflen );