Bug 1399679 - Expand the NextRequest macro from Xlib.h in nsX11ErrorHandler.cpp
On CentOS 6, the macro expands to:
(((_XPrivDisplay)(dpy))->request + 1)
On Debian wheezy, it expands to:
(((_XPrivDisplay)dpy)->request + 1)
where dpy is the argument it's given in both cases.
This could make a difference if dpy was a non trivial expression, but in
nsX11ErrorHandler.cpp, it's simply "display", which is a `Display*`.
So both expansions have the same semantics, but for some reason, in
nsX11ErrorHandler.cpp, using one or the other causes the compiler to
reorder some of the instructions it emits.
--- a/toolkit/xre/nsX11ErrorHandler.cpp
+++ b/toolkit/xre/nsX11ErrorHandler.cpp
@@ -15,17 +15,17 @@
#define BUFSIZE 2048 // What Xlib uses with XGetErrorDatabaseText
extern "C" {
int
X11Error(Display *display, XErrorEvent *event) {
// Get an indication of how long ago the request that caused the error was
// made.
- unsigned long age = NextRequest(display) - event->serial;
+ unsigned long age = (((_XPrivDisplay)(display))->request + 1) - event->serial;
// Get a string to represent the request that caused the error.
nsAutoCString message;
if (event->request_code < 128) {
// Core protocol request
message.AppendInt(event->request_code);
} else {
// Extension request