Commit e61e9795 authored by Ulrich Sibiller's avatar Ulrich Sibiller

nxagent: half number of NameForAtom calls

Because of validateString being a macro NameForAtom was called twice most of the time. Fix that by making validateString a function. Fixes ArticaProject/nx-libs#357
parent 89ccf26d
...@@ -133,6 +133,4 @@ typedef XID KeySym64; ...@@ -133,6 +133,4 @@ typedef XID KeySym64;
#undef KeySym #undef KeySym
#endif /*_XSERVER64_tmp*/ #endif /*_XSERVER64_tmp*/
#define validateString(string) ((string) ? (string) : "(null)")
#endif /* __Agent_H__ */ #endif /* __Agent_H__ */
...@@ -70,6 +70,7 @@ is" without express or implied warranty. ...@@ -70,6 +70,7 @@ is" without express or implied warranty.
#include "Handlers.h" #include "Handlers.h"
#include "Error.h" #include "Error.h"
#include "Reconnect.h" #include "Reconnect.h"
#include "Atoms.h"
/* /*
* NX includes and definitions. * NX includes and definitions.
......
...@@ -95,6 +95,10 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] = ...@@ -95,6 +95,10 @@ static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] =
static XErrorHandler previousErrorHandler = NULL; static XErrorHandler previousErrorHandler = NULL;
const char * validateString(const char *str) {
return str ? str : "(null)";
}
static void catchAndRedirect(Display* dpy, XErrorEvent* X) static void catchAndRedirect(Display* dpy, XErrorEvent* X)
{ {
if (X -> error_code == BadAccess && if (X -> error_code == BadAccess &&
......
...@@ -36,6 +36,8 @@ extern Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS]; ...@@ -36,6 +36,8 @@ extern Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS];
extern Bool nxagentWMIsRunning; extern Bool nxagentWMIsRunning;
extern const char * validateString(const char *);
/* /*
* Create the required atoms internally * Create the required atoms internally
* to the agent server. * to the agent server.
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include "Handlers.h" #include "Handlers.h"
#include "Events.h" #include "Events.h"
#include "Drawable.h" #include "Drawable.h"
#include "Atoms.h"
/* /*
* Need to include this after the stub * Need to include this after the stub
......
...@@ -57,6 +57,7 @@ is" without express or implied warranty. ...@@ -57,6 +57,7 @@ is" without express or implied warranty.
#include "Reconnect.h" #include "Reconnect.h"
#include "Args.h" #include "Args.h"
#include "Atoms.h"
#include "compext/Compext.h" #include "compext/Compext.h"
#include <nx/NXalert.h> #include <nx/NXalert.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment