MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Cvar_QSortByName

Function Cvar_QSortByName

code/qcommon/cvar.cpp:484–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

482}
483
484static void Cvar_QSortByName( cvar_t **a, int n )
485{
486 cvar_t *temp;
487 cvar_t *m;
488 int i, j;
489
490 i = 0;
491 j = n;
492 m = a[ n>>1 ];
493
494 do {
495 // sort in descending order
496 while ( strcmp( a[i]->name, m->name ) > 0 ) i++;
497 while ( strcmp( a[j]->name, m->name ) < 0 ) j--;
498
499 if ( i <= j ) {
500 temp = a[i];
501 a[i] = a[j];
502 a[j] = temp;
503 i++;
504 j--;
505 }
506 } while ( i <= j );
507
508 if ( j > 0 ) Cvar_QSortByName( a, j );
509 if ( n > i ) Cvar_QSortByName( a+i, n-i );
510}
511
512
513static void Cvar_Sort( void )

Callers 1

Cvar_SortFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected