Fix attribute sorting

This commit is contained in:
Howard Chu 2005-05-12 03:24:49 +00:00
parent 37ed2af7e7
commit 923bea9e14

View File

@ -181,24 +181,23 @@ str2entry2( char *s, int checkvals )
int fv; int fv;
for (i=0; i<lines; i++) { for (i=0; i<lines; i++) {
k = i;
for ( j=i+1; j<lines; j++ ) { for ( j=i+1; j<lines; j++ ) {
if ( bvmatch( type+i, type+j )) { if ( bvmatch( type+i, type+j )) {
/* out of order, move intervening attributes down */ /* out of order, move intervening attributes down */
if ( j != k+1 ) { if ( j != i+1 ) {
int l;
bv = vals[j]; bv = vals[j];
fv = freeval[j]; fv = freeval[j];
for ( l=j; l>k; l-- ) { for ( k=j; k>i; k-- ) {
type[l] = type[l-1]; type[k] = type[k-1];
vals[l] = vals[l-1]; vals[k] = vals[k-1];
freeval[l] = freeval[l-1]; freeval[k] = freeval[k-1];
} }
type[l] = type[i]; k++;
vals[l] = bv; type[k] = type[i];
freeval[l] = fv; vals[k] = bv;
freeval[k] = fv;
} }
i = k = j; i++;
} }
} }
} }