tweaks: rename five variables, away from a single letter
parent
a5b48f9a0d
commit
07a9477213
51
src/global.c
51
src/global.c
|
@ -376,39 +376,37 @@ void add_to_sclist(int menus, const char *scstring, const int keycode,
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
#endif
|
#endif
|
||||||
keystruct *s = nmalloc(sizeof(keystruct));
|
keystruct *sc = nmalloc(sizeof(keystruct));
|
||||||
|
|
||||||
/* Start the list, or tack on the next item. */
|
/* Start the list, or tack on the next item. */
|
||||||
if (sclist == NULL)
|
if (sclist == NULL)
|
||||||
sclist = s;
|
sclist = sc;
|
||||||
else
|
else
|
||||||
tailsc->next = s;
|
tailsc->next = sc;
|
||||||
s->next = NULL;
|
sc->next = NULL;
|
||||||
|
|
||||||
/* Fill in the data. */
|
/* Fill in the data. */
|
||||||
s->menus = menus;
|
sc->menus = menus;
|
||||||
s->func = func;
|
sc->func = func;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
s->toggle = toggle;
|
sc->toggle = toggle;
|
||||||
/* When not the same toggle as the previous one, increment the ID. */
|
/* When not the same toggle as the previous one, increment the ID. */
|
||||||
if (toggle)
|
if (toggle)
|
||||||
s->ordinal = (tailsc->toggle == toggle) ? counter : ++counter;
|
sc->ordinal = (tailsc->toggle == toggle) ? counter : ++counter;
|
||||||
#endif
|
#endif
|
||||||
s->keystr = scstring;
|
sc->keystr = scstring;
|
||||||
s->keycode = (keycode ? keycode : keycode_from_string(scstring));
|
sc->keycode = (keycode ? keycode : keycode_from_string(scstring));
|
||||||
|
|
||||||
tailsc = s;
|
tailsc = sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the first shortcut in the list of shortcuts that
|
/* Return the first shortcut in the list of shortcuts that
|
||||||
* matches the given func in the given menu. */
|
* matches the given func in the given menu. */
|
||||||
const keystruct *first_sc_for(int menu, void (*func)(void))
|
const keystruct *first_sc_for(int menu, void (*func)(void))
|
||||||
{
|
{
|
||||||
const keystruct *s;
|
for (keystruct *sc = sclist; sc != NULL; sc = sc->next)
|
||||||
|
if ((sc->menus & menu) && sc->func == func)
|
||||||
for (s = sclist; s != NULL; s = s->next)
|
return sc;
|
||||||
if ((s->menus & menu) && s->func == func)
|
|
||||||
return s;
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -417,14 +415,14 @@ const keystruct *first_sc_for(int menu, void (*func)(void))
|
||||||
* current menu, if any; otherwise, return the given default value. */
|
* current menu, if any; otherwise, return the given default value. */
|
||||||
int the_code_for(void (*func)(void), int defaultval)
|
int the_code_for(void (*func)(void), int defaultval)
|
||||||
{
|
{
|
||||||
const keystruct *s = first_sc_for(currmenu, func);
|
const keystruct *sc = first_sc_for(currmenu, func);
|
||||||
|
|
||||||
if (s == NULL)
|
if (sc == NULL)
|
||||||
return defaultval;
|
return defaultval;
|
||||||
|
|
||||||
meta_key = (0x20 <= s->keycode && s->keycode <= 0x7E);
|
meta_key = (0x20 <= sc->keycode && sc->keycode <= 0x7E);
|
||||||
|
|
||||||
return s->keycode;
|
return sc->keycode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the number of entries that can be shown in the given menu. */
|
/* Return the number of entries that can be shown in the given menu. */
|
||||||
|
@ -462,9 +460,9 @@ const keystruct *get_shortcut(int *kbinput)
|
||||||
if (bracketed_paste && *kbinput != BRACKETED_PASTE_MARKER)
|
if (bracketed_paste && *kbinput != BRACKETED_PASTE_MARKER)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (keystruct *s = sclist; s != NULL; s = s->next) {
|
for (keystruct *sc = sclist; sc != NULL; sc = sc->next) {
|
||||||
if ((s->menus & currmenu) && *kbinput == s->keycode)
|
if ((sc->menus & currmenu) && *kbinput == sc->keycode)
|
||||||
return s;
|
return sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -473,12 +471,9 @@ const keystruct *get_shortcut(int *kbinput)
|
||||||
/* Return a pointer to the function that is bound to the given key. */
|
/* Return a pointer to the function that is bound to the given key. */
|
||||||
functionptrtype func_from_key(int *kbinput)
|
functionptrtype func_from_key(int *kbinput)
|
||||||
{
|
{
|
||||||
const keystruct *s = get_shortcut(kbinput);
|
const keystruct *sc = get_shortcut(kbinput);
|
||||||
|
|
||||||
if (s)
|
return (sc) ? sc->func : NULL;
|
||||||
return s->func;
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_BROWSER) || defined(ENABLE_HELP)
|
#if defined(ENABLE_BROWSER) || defined(ENABLE_HELP)
|
||||||
|
|
Loading…
Reference in New Issue