xkb: variable cleanup in SetUpRemap()

declare variables where necessary.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-10-20 14:49:11 +02:00
committed by Enrico Weigelt
parent fb5274d7ac
commit db5062c041

View File

@@ -263,25 +263,26 @@ get_index(char *str, int *ndx)
static void static void
SetUpRemap(InputLine * line, RemapSpec * remap) SetUpRemap(InputLine * line, RemapSpec * remap)
{ {
char *tok, *str; char *tok;
unsigned present, l_ndx_present, v_ndx_present;
int len, ndx;
_Xstrtokparams strtok_buf; _Xstrtokparams strtok_buf;
Bool found;
l_ndx_present = v_ndx_present = present = 0; unsigned l_ndx_present = 0;
str = &line->line[1]; unsigned v_ndx_present = 0;
len = remap->number; unsigned present = 0;
char *str = &line->line[1];
int len = remap->number;
memset((char *) remap, 0, sizeof(RemapSpec)); memset((char *) remap, 0, sizeof(RemapSpec));
remap->number = len; remap->number = len;
while ((tok = _XStrtok(str, " ", strtok_buf)) != NULL) { while ((tok = _XStrtok(str, " ", strtok_buf)) != NULL) {
found = FALSE; Bool found = FALSE;
str = NULL; str = NULL;
if (strcmp(tok, "=") == 0) if (strcmp(tok, "=") == 0)
continue; continue;
for (int i = 0; i < MAX_WORDS; i++) { for (int i = 0; i < MAX_WORDS; i++) {
len = strlen(cname[i]); len = strlen(cname[i]);
if (strncmp(cname[i], tok, len) == 0) { if (strncmp(cname[i], tok, len) == 0) {
int ndx;
if (strlen(tok) > len) { if (strlen(tok) > len) {
char *end = get_index(tok + len, &ndx); char *end = get_index(tok + len, &ndx);