mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-26 22:50:06 +01:00
Revert "xkb: drop unused XkbRF_LoadRulesByName()"
This reverts commit e38eeb4718.
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2046>
This commit is contained in:
parent
f21c9b9fc3
commit
d8aedc5cfc
2 changed files with 38 additions and 0 deletions
|
|
@ -98,6 +98,13 @@ extern _X_EXPORT Bool XkbRF_LoadRules(FILE * /* file */ ,
|
||||||
XkbRF_RulesPtr /* rules */
|
XkbRF_RulesPtr /* rules */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
extern _X_EXPORT Bool XkbRF_LoadRulesByName(char * /* base */ ,
|
||||||
|
char * /* locale */ ,
|
||||||
|
XkbRF_RulesPtr /* rules */
|
||||||
|
);
|
||||||
|
|
||||||
|
/***====================================================================***/
|
||||||
|
|
||||||
extern _X_EXPORT XkbRF_RulesPtr XkbRF_Create(void);
|
extern _X_EXPORT XkbRF_RulesPtr XkbRF_Create(void);
|
||||||
|
|
||||||
extern _X_EXPORT void XkbRF_Free(XkbRF_RulesPtr /* rules */ ,
|
extern _X_EXPORT void XkbRF_Free(XkbRF_RulesPtr /* rules */ ,
|
||||||
|
|
|
||||||
|
|
@ -963,6 +963,37 @@ XkbRF_LoadRules(FILE * file, XkbRF_RulesPtr rules)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
XkbRF_LoadRulesByName(char *base, char *locale, XkbRF_RulesPtr rules)
|
||||||
|
{
|
||||||
|
FILE *file;
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
Bool ok;
|
||||||
|
|
||||||
|
if ((!base) || (!rules))
|
||||||
|
return FALSE;
|
||||||
|
if (locale) {
|
||||||
|
if (snprintf(buf, PATH_MAX, "%s-%s", base, locale) >= PATH_MAX)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (strlen(base) + 1 > PATH_MAX)
|
||||||
|
return FALSE;
|
||||||
|
strcpy(buf, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
file = fopen(buf, "r");
|
||||||
|
if ((!file) && (locale)) { /* fallback if locale was specified */
|
||||||
|
strcpy(buf, base);
|
||||||
|
file = fopen(buf, "r");
|
||||||
|
}
|
||||||
|
if (!file)
|
||||||
|
return FALSE;
|
||||||
|
ok = XkbRF_LoadRules(file, rules);
|
||||||
|
fclose(file);
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
XkbRF_RulesPtr
|
XkbRF_RulesPtr
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue