diff options
author | H. Peter Anvin <hpa@zytor.com> | 2012-02-27 22:01:48 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2012-02-27 22:01:48 -0800 |
commit | 2b061d66d26d1a381aaf2cee0e629bb696e0c9f8 (patch) | |
tree | 0a686a39466d121490c278610f5250cd13bbec9e /action.c | |
parent | 6d349aebe9db752359f485ba07edeec937491c18 (diff) | |
download | grv-2b061d66d26d1a381aaf2cee0e629bb696e0c9f8.tar.gz grv-2b061d66d26d1a381aaf2cee0e629bb696e0c9f8.tar.xz grv-2b061d66d26d1a381aaf2cee0e629bb696e0c9f8.zip |
action: Make sure event retiming really *is* a stable sort...
Diffstat (limited to 'action.c')
-rw-r--r-- | action.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -20,11 +20,13 @@ struct action { int x, y; enum actions what; double when; + uint64_t seq; }; #define MAXACT 80 static struct action actions[MAXACT]; static int action_count; +static uint64_t next_seq = 0; void addaction(int x, int y, double when, enum actions what) { @@ -41,6 +43,7 @@ void addaction(int x, int y, double when, enum actions what) actions[i].y = y; actions[i].when = when; actions[i].what = what; + actions[i].seq = next_seq++; action_count++; } @@ -72,7 +75,7 @@ static int sort_by_time(const void *a, const void *b) /* This *must* be a stable sort! */ if ( aa->when == bb->when ) - return (aa < bb) ? -1 : 1; + return (aa->seq < bb->seq) ? -1 : 1; else return (aa->when < bb->when) ? -1 : 1; } |