aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/Xrm.c
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2016-07-29 00:44:38 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-10 22:52:29 +0200
commit687d44b6eaa3c64a12af9bbd557b401419b208eb (patch)
tree55c30ba6b0ae6a2618395fae92922ea4402d52f6 /nx-X11/lib/X11/Xrm.c
parentea24f0b0eb7b82ad879810c8e84292d6bf810bea (diff)
downloadnx-libs-687d44b6eaa3c64a12af9bbd557b401419b208eb.tar.gz
nx-libs-687d44b6eaa3c64a12af9bbd557b401419b208eb.tar.bz2
nx-libs-687d44b6eaa3c64a12af9bbd557b401419b208eb.zip
update src files *[ch] to libX11 1.3.4
Diffstat (limited to 'nx-X11/lib/X11/Xrm.c')
-rw-r--r--nx-X11/lib/X11/Xrm.c72
1 files changed, 32 insertions, 40 deletions
diff --git a/nx-X11/lib/X11/Xrm.c b/nx-X11/lib/X11/Xrm.c
index 1469b745d..d88442c6e 100644
--- a/nx-X11/lib/X11/Xrm.c
+++ b/nx-X11/lib/X11/Xrm.c
@@ -4,13 +4,13 @@ Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard
All Rights Reserved
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
+both that copyright notice and this permission notice appear in
supporting documentation, and that the name Digital not be
used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
+software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
@@ -333,7 +333,6 @@ void XrmInitialize(void)
XrmQANY = XrmPermStringToQuark("?");
}
-#ifndef _XP_PRINT_SERVER_
XrmDatabase XrmGetDatabase(
Display *display)
{
@@ -357,7 +356,6 @@ void XrmSetDatabase(
display->db = database;
UnlockDisplay(display);
}
-#endif /* !_XP_PRINT_SERVER_ */
void
XrmStringToQuarkList(
@@ -501,11 +499,7 @@ static XrmDatabase NewDatabase(void)
_XCreateMutex(&db->linfo);
db->table = (NTable)NULL;
db->mbstate = (XPointer)NULL;
-#ifdef _XP_PRINT_SERVER_
- db->methods = NULL;
-#else
db->methods = _XrmInitParseInfo(&db->mbstate);
-#endif
if (!db->methods)
db->methods = &mb_methods;
}
@@ -806,6 +800,7 @@ void XrmCombineDatabase(
}
}
(from->methods->destroy)(from->mbstate);
+ _XUnlockMutex(&from->linfo);
_XFreeMutex(&from->linfo);
Xfree((char *)from);
_XUnlockMutex(&(*into)->linfo);
@@ -1068,20 +1063,20 @@ XrmQPutStringResource(
*/
/*
- * This function is highly optimized to inline as much as possible.
- * Be very careful with modifications, or simplifications, as they
+ * This function is highly optimized to inline as much as possible.
+ * Be very careful with modifications, or simplifications, as they
* may adversely affect the performance.
*
* Chris Peterson, MIT X Consortium 5/17/90.
*/
-/*
+/*
* Xlib spec says max 100 quarks in a lookup, will stop and return if
* return if any single production's lhs has more than 100 components.
*/
#define QLIST_SIZE 100
-/*
+/*
* This should be big enough to handle things like the XKeysymDB or biggish
* ~/.Xdefaults or app-defaults files. Anything bigger will be allocated on
* the heap.
@@ -1122,14 +1117,14 @@ static void GetDatabase(
if (!db)
return;
- /*
- * if strlen (str) < DEF_BUFF_SIZE allocate buffers on the stack for
+ /*
+ * if strlen (str) < DEF_BUFF_SIZE allocate buffers on the stack for
* speed otherwise malloc the buffer. From a buffer overflow standpoint
* we can be sure that neither: a) a component on the lhs, or b) a
* value on the rhs, will be longer than the overall length of str,
* i.e. strlen(str).
*
- * This should give good performance when parsing "*foo: bar" type
+ * This should give good performance when parsing "*foo: bar" type
* databases as might be passed with -xrm command line options; but
* with larger databases, e.g. .Xdefaults, app-defaults, or KeysymDB
* files, the size of the buffers will be overly large. One way
@@ -1140,7 +1135,7 @@ static void GetDatabase(
str_len = strlen (str);
if (DEF_BUFF_SIZE > str_len) lhs = lhs_s;
- else if ((lhs = (char*) Xmalloc (str_len)) == NULL)
+ else if ((lhs = (char*) Xmalloc (str_len)) == NULL)
return;
alloc_chars = DEF_BUFF_SIZE < str_len ? str_len : DEF_BUFF_SIZE;
@@ -1156,7 +1151,7 @@ static void GetDatabase(
dolines = doall;
/*
- * First: Remove extra whitespace.
+ * First: Remove extra whitespace.
*/
do {
@@ -1228,13 +1223,13 @@ static void GetDatabase(
* Third: loop through the LHS of the resource specification
* storing characters and converting this to a Quark.
*/
-
+
num_quarks = 0;
t_bindings = bindings;
sig = 0;
ptr = lhs;
- *t_bindings = XrmBindTightly;
+ *t_bindings = XrmBindTightly;
for(;;) {
if (!is_binding(bits)) {
while (!is_EOQ(bits)) {
@@ -1243,7 +1238,7 @@ static void GetDatabase(
bits = next_char(c, str);
}
- quarks[num_quarks++] =
+ quarks[num_quarks++] =
_XrmInternalStringToQuark(lhs, ptr - lhs, sig, False);
if (num_quarks > QLIST_SIZE) {
@@ -1263,9 +1258,9 @@ static void GetDatabase(
sig = (sig << 1) + c; /* Compute the signature. */
} while (is_space(bits = next_char(c, str)));
- /*
+ /*
* The spec doesn't permit it, but support spaces
- * internal to resource name/class
+ * internal to resource name/class
*/
if (is_separator(bits))
@@ -1289,7 +1284,7 @@ static void GetDatabase(
* If two separators appear with no Text between them then
* ignore them.
*
- * If anyone of those separators is a '*' then the binding
+ * If anyone of those separators is a '*' then the binding
* will be loose, otherwise it will be tight.
*/
@@ -1334,7 +1329,7 @@ static void GetDatabase(
* the right hand side.
*/
- /*
+ /*
* Fourth: Remove more whitespace
*/
@@ -1352,7 +1347,7 @@ static void GetDatabase(
break;
}
- /*
+ /*
* Fifth: Process the right hand side.
*/
@@ -1453,8 +1448,8 @@ static void GetDatabase(
else {
int tcount;
- /*
- * Otherwise just insert those characters into the
+ /*
+ * Otherwise just insert those characters into the
* string, since no special processing is needed on
* numerics we can skip the special processing.
*/
@@ -1477,7 +1472,7 @@ static void GetDatabase(
}
}
- /*
+ /*
* It is important to make sure that there is room for at least
* four more characters in the buffer, since I can add that
* many characters into the buffer after a backslash has occured.
@@ -1486,7 +1481,7 @@ static void GetDatabase(
if (ptr + len > ptr_max) {
char * temp_str;
- alloc_chars += BUFSIZ/10;
+ alloc_chars += BUFSIZ/10;
temp_str = Xrealloc(rhs, sizeof(char) * alloc_chars);
if (!temp_str) {
@@ -1503,7 +1498,7 @@ static void GetDatabase(
}
/*
- * Lastly: Terminate the value string, and store this entry
+ * Lastly: Terminate the value string, and store this entry
* into the database.
*/
@@ -1512,7 +1507,7 @@ static void GetDatabase(
/* Store it in database */
value.size = ptr - rhs;
value.addr = (XPointer) rhs;
-
+
PutEntry(db, bindings, quarks, XrmQString, &value);
}
@@ -2277,7 +2272,7 @@ Bool XrmQGetSearchList(
} else {
if (table && !table->leaf)
table = table->next;
- if (table &&
+ if (table &&
AppendLEntry((LTable)table, names, classes, &closure)) {
_XUnlockMutex(&db->linfo);
return False;
@@ -2570,12 +2565,8 @@ Bool XrmQGetResource(
}
Bool
-XrmGetResource(db, name_str, class_str, pType_str, pValue)
- XrmDatabase db;
- _Xconst char *name_str;
- _Xconst char *class_str;
- XrmString *pType_str; /* RETURN */
- XrmValuePtr pValue; /* RETURN */
+XrmGetResource(XrmDatabase db, _Xconst char *name_str, _Xconst char *class_str,
+ XrmString *pType_str, XrmValuePtr pValue)
{
XrmName names[MAXDBDEPTH+1];
XrmClass classes[MAXDBDEPTH+1];
@@ -2654,6 +2645,7 @@ void XrmDestroyDatabase(
else
DestroyNTable(table);
}
+ _XUnlockMutex(&db->linfo);
_XFreeMutex(&db->linfo);
(*db->methods->destroy)(db->mbstate);
Xfree((char *)db);