X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdictionary%2Fsort-variables.c;fp=src%2Flanguage%2Fdictionary%2Fsort-variables.c;h=aee341bda61770f633964c1ab493960c0366ed4a;hb=85e8724e69cf54946c7b40628e88f2ec12368d7c;hp=8c653af7248c1cf8470009e06d7c53dba483a129;hpb=cf5c60f6f2c5d7d6dcad09bc30162b70ad01c181;p=pspp diff --git a/src/language/dictionary/sort-variables.c b/src/language/dictionary/sort-variables.c index 8c653af724..aee341bda6 100644 --- a/src/language/dictionary/sort-variables.c +++ b/src/language/dictionary/sort-variables.c @@ -190,7 +190,11 @@ compare_vars (const void *a_, const void *b_, const void *c_) /* Make this a stable sort. */ if (!retval) - retval = a < b ? -1 : a > b; + { + size_t a_index = var_get_dict_index (a); + size_t b_index = var_get_dict_index (b); + retval = a_index < b_index ? -1 : a_index > b_index; + } if (c->descending) retval = -retval;