Skip to content

Commit 3afe9d8

Browse files
zsugabubusmtwebster
authored andcommitted
nemo-action-manager.c: Do not reinvent strcmp
1 parent f866998 commit 3afe9d8

1 file changed

Lines changed: 1 addition & 25 deletions

File tree

libnemo-private/nemo-action-manager.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -145,37 +145,13 @@ sort_file_list_cb (gconstpointer a, gconstpointer b)
145145
NemoFile *file_b;
146146
const char *s0;
147147
const char *s1;
148-
gint r;
149148

150149
file_a = (NemoFile *) a;
151150
file_b = (NemoFile *) b;
152151
s0 = nemo_file_peek_name (file_a);
153152
s1 = nemo_file_peek_name (file_b);
154-
//
155-
// Order alphabetically
156-
// Compare ASCII values of file names char by char
157-
// < 0: a < b
158-
// == 0: a == b
159-
// > 0: a > b
160-
//
161-
do {
162-
char c0 = *s0++;
163-
char c1 = *s1++;
164-
if (c0 < c1) {
165-
r = -1;
166-
break;
167-
}
168-
if (c0 > c1) {
169-
r = 1;
170-
break;
171-
}
172-
if (c0 == 0) { // Special case: Both strings are identical and we have hit the \0 char? => Return equal
173-
r = 0;
174-
break;
175-
}
176-
} while (TRUE);
177153

178-
return r;
154+
return g_strcmp0 (s0, s1);
179155
}
180156

181157
static void

0 commit comments

Comments
 (0)