X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdictionary%2Fmodify-variables.c;h=c74cd529afe2b31f0fab2872365f1b006b2ff568;hb=c03a42996cfd422728e85631682ed13a8c298f2a;hp=1e42cb6de0a90caaee4f2d03a28cced19d996965;hpb=888d0f91d57e0c3c5a4206c30ac71eb87bf44227;p=pspp diff --git a/src/language/dictionary/modify-variables.c b/src/language/dictionary/modify-variables.c index 1e42cb6de0..c74cd529af 100644 --- a/src/language/dictionary/modify-variables.c +++ b/src/language/dictionary/modify-variables.c @@ -1,6 +1,5 @@ /* PSPP - computes sample statistics. Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. - Written by Ben Pfaff . This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -354,8 +353,12 @@ compare_variables_given_ordering (const void *a_, const void *b_, const struct ordering *ordering = ordering_; int result; - if (ordering->positional) - result = a->index < b->index ? -1 : a->index > b->index; + if (ordering->positional) + { + size_t a_index = var_get_dict_index (a); + size_t b_index = var_get_dict_index (b); + result = a_index < b_index ? -1 : a_index > b_index; + } else result = strcasecmp (var_get_name (a), var_get_name (b)); if (!ordering->forward)