diff options
Diffstat (limited to 'libX11/src/Xrm.c')
-rw-r--r-- | libX11/src/Xrm.c | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/libX11/src/Xrm.c b/libX11/src/Xrm.c index 65d058fa5..46bc31daa 100644 --- a/libX11/src/Xrm.c +++ b/libX11/src/Xrm.c @@ -5,13 +5,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 @@ -335,7 +335,6 @@ void XrmInitialize(void) XrmQANY = XrmPermStringToQuark("?"); } -#ifndef _XP_PRINT_SERVER_ XrmDatabase XrmGetDatabase( Display *display) { @@ -359,7 +358,6 @@ void XrmSetDatabase( display->db = database; UnlockDisplay(display); } -#endif /* !_XP_PRINT_SERVER_ */ void XrmStringToQuarkList( @@ -503,11 +501,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; } @@ -1071,20 +1065,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. @@ -1125,14 +1119,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 @@ -1143,7 +1137,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; @@ -1159,7 +1153,7 @@ static void GetDatabase( dolines = doall; /* - * First: Remove extra whitespace. + * First: Remove extra whitespace. */ do { @@ -1231,13 +1225,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)) { @@ -1246,7 +1240,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) { @@ -1266,9 +1260,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)) @@ -1292,7 +1286,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. */ @@ -1337,7 +1331,7 @@ static void GetDatabase( * the right hand side. */ - /* + /* * Fourth: Remove more whitespace */ @@ -1355,7 +1349,7 @@ static void GetDatabase( break; } - /* + /* * Fifth: Process the right hand side. */ @@ -1456,8 +1450,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. */ @@ -1480,7 +1474,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. @@ -1489,7 +1483,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) { @@ -1506,7 +1500,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. */ @@ -1515,7 +1509,7 @@ static void GetDatabase( /* Store it in database */ value.size = ptr - rhs; value.addr = (XPointer) rhs; - + PutEntry(db, bindings, quarks, XrmQString, &value); } @@ -2280,7 +2274,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; @@ -2573,12 +2567,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]; |