]> git.sur5r.net Git - i3/i3/commitdiff
generate parser enums stably: additionally sort on name 1833/head
authorChris West (Faux) <git@goeswhere.com>
Wed, 5 Aug 2015 20:21:31 +0000 (21:21 +0100)
committerChris West (Faux) <git@goeswhere.com>
Wed, 5 Aug 2015 20:23:51 +0000 (21:23 +0100)
generate-command-parser.pl

index f40bb390100b1ff3c26a748e4c84473a54e0317d..c0a9a4d42755ea9c11b6c983fa216f53fc849459 100755 (executable)
@@ -112,7 +112,7 @@ for my $line (@lines) {
 # We sort descendingly by length to be able to replace occurences of the state
 # name even when one state’s name is included in another one’s (like FOR_WINDOW
 # is in FOR_WINDOW_COMMAND).
 # We sort descendingly by length to be able to replace occurences of the state
 # name even when one state’s name is included in another one’s (like FOR_WINDOW
 # is in FOR_WINDOW_COMMAND).
-my @keys = sort { length($b) <=> length($a) } keys %states;
+my @keys = sort { (length($b) <=> length($a)) or ($a cmp $b) } keys %states;
 
 open(my $enumfh, '>', "GENERATED_${prefix}_enums.h");
 
 
 open(my $enumfh, '>', "GENERATED_${prefix}_enums.h");