rem: int tmp; #if 0  int limit;  if(bPtr->usedColumnCount < bPtr->maxVisibleColumns) limit = bPtr->usedColumnCount; else limit = bPtr->maxVisibleColumns;  for (i=column; i < limit; i++) { if (bPtr->titles[i]) free(bPtr->titles[i]);
add: clearEnd = bPtr->maxVisibleColumns; destroyEnd = bPtr->columnCount; bPtr->columnCount = bPtr->maxVisibleColumns; } else { clearEnd = column; destroyEnd = bPtr->columnCount; bPtr->columnCount = column; } if (column < bPtr->usedColumnCount) { bPtr->usedColumnCount = column; } for (i=column; i < clearEnd; i++) { if (bPtr->titles[i]) { free(bPtr->titles[i]);
context: removeColumn(WMBrowser *bPtr, int column){    int i;    WMList **clist;    char **tlist;    if (column >= bPtr->usedColumnCount)	return;    if (column < bPtr->maxVisibleColumns) {	int tmp;#if 0	/* this code causes bugs */	int limit;	if(bPtr->usedColumnCount < bPtr->maxVisibleColumns)	    limit = bPtr->usedColumnCount;	else	    limit = bPtr->maxVisibleColumns;	for (i=column; i < limit; i++) {	    if (bPtr->titles[i])		free(bPtr->titles[i]);	    bPtr->titles[i] = NULL;	    	    WMClearList(bPtr->columns[i]);	    bPtr->usedColumnCount--;	}#else	for (i=column; i < bPtr->maxVisibleColumns; i++) {	    if (bPtr->titles[i])		free(bPtr->titles[i]);	    bPtr->titles[i] = NULL;	    	    WMClearList(bPtr->columns[i]);	    bPtr->usedColumnCount--;	}	tmp = bPtr->columnCount;	for (i=bPtr->maxVisibleColumns; i < tmp; i++) {	    if (bPtr->titles[i])		free(bPtr->titles[i]);	    bPtr->titles[i] = NULL;	    	    WMDestroyWidget(bPtr->columns[i]);	    bPtr->columns[i] = NULL;	    bPtr->columnCount--;	    bPtr->usedColumnCount--;	}#endif    } else {	int tmp = bPtr->columnCount;	for (i=column; i < tmp; i++) {	    if (bPtr->titles[i])		free(bPtr->titles[i]);	    bPtr->titles[i] = NULL;	    	    WMDestroyWidget(bPtr->columns[i]);	    bPtr->columns[i] = NULL;	    bPtr->columnCount--;	    bPtr->usedColumnCount--;	}	    }    clist = wmalloc(sizeof(WMList*)*bPtr->columnCount);    tlist = wmalloc(sizeof(char*)*bPtr->columnCount);    memcpy(clist, bPtr->columns, sizeof(WMList*)*bPtr->columnCount);    memcpy(tlist, bPtr->titles, sizeof(char*)*bPtr->columnCount);    free(bPtr->titles);    free(bPtr->columns);    bPtr->titles = tlist;    bPtr->columns = clist;}