Fix #1937 - Fix flag sorting order

This commit is contained in:
pancake 2015-01-09 17:37:06 +01:00
parent 826477db9a
commit 935c4db50e
2 changed files with 7 additions and 6 deletions

View File

@ -81,7 +81,7 @@ R_API void r_flag_list(RFlag *f, int rad) {
case 'j': {
int first = 1;
r_cons_printf ("[");
r_list_foreach_prev (f->flags, iter, flag) {
r_list_foreach (f->flags, iter, flag) {
if ((f->space_idx != -1) && (flag->space != f->space_idx))
continue;
r_cons_printf ("%s{\"name\":\"%s\",\"size\":\"%"PFMT64d"\",",
@ -101,7 +101,7 @@ R_API void r_flag_list(RFlag *f, int rad) {
break;
case 1:
case '*':
r_list_foreach_prev (f->flags, iter, flag) {
r_list_foreach (f->flags, iter, flag) {
if ((f->space_idx != -1) && (flag->space != f->space_idx))
continue;
if (fs == -1 || flag->space != fs) {
@ -124,7 +124,7 @@ R_API void r_flag_list(RFlag *f, int rad) {
}
break;
case 'n': // show original name
r_list_foreach_prev (f->flags, iter, flag) {
r_list_foreach (f->flags, iter, flag) {
if ((f->space_idx != -1) && (flag->space != f->space_idx))
continue;
if (flag->alias) {
@ -137,7 +137,7 @@ R_API void r_flag_list(RFlag *f, int rad) {
}
break;
default:
r_list_foreach_prev (f->flags, iter, flag) {
r_list_foreach (f->flags, iter, flag) {
if ((f->space_idx != -1) && (flag->space != f->space_idx))
continue;
if (flag->alias) {

View File

@ -1,4 +1,5 @@
/* radare - LGPL - Copyright 2007-2011 pancake<nopcode.org> */
/* radare - LGPL - Copyright 2007-2015 pancake */
#include <r_flags.h>
/* compare names */
@ -32,7 +33,7 @@ R_API int r_flag_sort(RFlag *f, int namesort) {
fi = flag;
it_elem = iter;
changes = 1;
} else if (((namesort)? ncmp (fi, flag): cmp (fi, flag)) <= 0) {
} else if (((namesort)? ncmp (fi, flag): cmp (fi, flag)) > 0) {
fi = flag;
it_elem = iter;
changes = 1;