ttyname: use precomputed lengths
[nedit-bw.git] / versionedServerAtoms.patch
blob4ce47b1e88d25981fc7c62b18351ca6ee0e615ae
1 ---
3 source/server_common.c | 47 ++++++++++++++++++++++++++++++++++++++---------
4 1 file changed, 38 insertions(+), 9 deletions(-)
6 diff --quilt old/source/server_common.c new/source/server_common.c
7 --- old/source/server_common.c
8 +++ new/source/server_common.c
9 @@ -39,6 +39,9 @@
10 #include "server_common.h"
11 #include "../util/utils.h"
13 +#define NEDIT_VERSION_STRING "5.7"
14 +#define NEDIT_VERSION_STRING_LEN 3
17 * Create the server property atoms for the server with serverName.
18 * Atom names are generated as follows:
19 @@ -56,13 +59,19 @@ void CreateServerPropertyAtoms(const cha
20 Atom *serverExistsAtomReturn,
21 Atom *serverRequestAtomReturn)
23 - char propName[20+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN];
24 + char propName[20+1+
25 + NEDIT_VERSION_STRING_LEN+1+
26 + MAXNODENAMELEN+1+
27 + MAXUSERNAMELEN+1+
28 + MAXSERVERNAMELEN+1];
29 const char *userName = GetUserName();
30 const char *hostName = GetNameOfHost();
32 - sprintf(propName, "NEDIT_SERVER_EXISTS_%s_%s_%s", hostName, userName, serverName);
33 + sprintf(propName, "NEDIT_%s_SERVER_EXISTS_%s_%s_%s",
34 + NEDIT_VERSION_STRING, hostName, userName, serverName);
35 *serverExistsAtomReturn = XInternAtom(TheDisplay, propName, False);
36 - sprintf(propName, "NEDIT_SERVER_REQUEST_%s_%s_%s", hostName, userName, serverName);
37 + sprintf(propName, "NEDIT_%s_SERVER_REQUEST_%s_%s_%s",
38 + NEDIT_VERSION_STRING, hostName, userName, serverName);
39 *serverRequestAtomReturn = XInternAtom(TheDisplay, propName, False);
42 @@ -86,12 +95,19 @@ void CreateServerPropertyAtoms(const cha
43 Atom CreateServerFileOpenAtom(const char *serverName,
44 const char *path)
46 - char propName[10+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+7];
47 + char propName[10+1+
48 + NEDIT_VERSION_STRING_LEN+1+
49 + MAXNODENAMELEN+1+
50 + MAXUSERNAMELEN+1+
51 + MAXSERVERNAMELEN+1+
52 + MAXPATHLEN+1+
53 + 7+1];
54 const char *userName = GetUserName();
55 const char *hostName = GetNameOfHost();
56 Atom atom;
58 - sprintf(propName, "NEDIT_FILE_%s_%s_%s_%s_WF_OPEN", hostName, userName, serverName, path);
59 + sprintf(propName, "NEDIT_%s_FILE_%s_%s_%s_%s_WF_OPEN",
60 + NEDIT_VERSION_STRING, hostName, userName, serverName, path);
61 atom = XInternAtom(TheDisplay, propName, False);
62 return(atom);
64 @@ -100,12 +116,19 @@ Atom CreateServerFileClosedAtom(const ch
65 const char *path,
66 Bool only_if_exist)
68 - char propName[10+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1+MAXPATHLEN+1+9];
69 + char propName[10+1+
70 + NEDIT_VERSION_STRING_LEN+1+
71 + MAXNODENAMELEN+1+
72 + MAXUSERNAMELEN+1+
73 + MAXSERVERNAMELEN+1+
74 + MAXPATHLEN+1+
75 + 9+1];
76 const char *userName = GetUserName();
77 const char *hostName = GetNameOfHost();
78 Atom atom;
80 - sprintf(propName, "NEDIT_FILE_%s_%s_%s_%s_WF_CLOSED", hostName, userName, serverName, path);
81 + sprintf(propName, "NEDIT_%s_FILE_%s_%s_%s_%s_WF_CLOSED",
82 + NEDIT_VERSION_STRING, hostName, userName, serverName, path);
83 atom = XInternAtom(TheDisplay, propName, only_if_exist);
84 return(atom);
86 @@ -116,10 +139,16 @@ Atom CreateServerFileClosedAtom(const ch
88 void DeleteServerFileAtoms(const char* serverName, Window rootWindow)
90 - char propNamePrefix[10+1+MAXNODENAMELEN+1+MAXUSERNAMELEN+1+MAXSERVERNAMELEN+1];
91 + char propNamePrefix[10+1+
92 + NEDIT_VERSION_STRING_LEN+1+
93 + MAXNODENAMELEN+1+
94 + MAXUSERNAMELEN+1+
95 + MAXSERVERNAMELEN+1+
96 + 1];
97 const char *userName = GetUserName();
98 const char *hostName = GetNameOfHost();
99 - int length = sprintf(propNamePrefix, "NEDIT_FILE_%s_%s_%s_", hostName, userName, serverName);
100 + int length = sprintf(propNamePrefix, "NEDIT_%s_FILE_%s_%s_%s_",
101 + NEDIT_VERSION_STRING, hostName, userName, serverName);
103 int nProperties;
104 Atom* atoms = XListProperties(TheDisplay, rootWindow, &nProperties);