summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Wong <gtw@gnu.org>2009-08-27 15:29:18 -0600
committerGary Wong <gtw@gnu.org>2009-08-27 15:29:18 -0600
commit7bba687a40afda1e0a40a144bc4b7ae0cf577c70 (patch)
tree30ea3357e4a1787e3049aa45e353ec423c3c8b34
parentd4d7cb93352df136578fb13e9c59029d10781955 (diff)
Use unsigned arithmetic for sequence comparison.
-rw-r--r--ChangeLog6
-rw-r--r--gwm.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ce89b5b..4190484 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-08-27 Gary Wong <gtw@gnu.org>
+ * gwm.c (sync_with_callback): Perform the sequence comparison
+ with unsigned arithmetic, so that overflow semantics are
+ well-defined.
+
+2009-08-27 Gary Wong <gtw@gnu.org>
+
* frame.c (recalc_size): Implement edge resistance when resizing
frames.
(edge_resist): New function.
diff --git a/gwm.c b/gwm.c
index 7246679..ba30d72 100644
--- a/gwm.c
+++ b/gwm.c
@@ -25,6 +25,7 @@
#include <assert.h>
#include <errno.h>
+#include <limits.h>
#if HAVE_MCHECK_H
#include <mcheck.h>
#endif
@@ -264,7 +265,7 @@ static void check_async_callbacks( void ) {
extern void sync_with_callback( unsigned int sequence ) {
- while( queue_head && (int) sequence - (int) queue_head->sequence >= 0 ) {
+ while( queue_head && sequence - queue_head->sequence < UINT_MAX >> 1 ) {
struct async_callback *entry = queue_head;
xcb_generic_error_t *error;
void *reply = xcb_wait_for_reply( c, entry->sequence, &error );