followup to PR #744
Pull some pointer assignments in wc_set_window_colors() out of if-else-endif so that it is more obvious that they can't be Null.
This commit is contained in:
+14
-19
@@ -8689,7 +8689,9 @@ wc_set_window_colors(char *op)
|
|||||||
int j;
|
int j;
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
char *wn, *tfg, *tbg, *newop;
|
char *wn, *tfg, *tbg, *newop;
|
||||||
static const char *const wnames[] = { "menu", "message", "status", "text" };
|
static const char *const wnames[] = {
|
||||||
|
"menu", "message", "status", "text"
|
||||||
|
};
|
||||||
static const char *const shortnames[] = { "mnu", "msg", "sts", "txt" };
|
static const char *const shortnames[] = { "mnu", "msg", "sts", "txt" };
|
||||||
static char **fgp[] = { &iflags.wc_foregrnd_menu,
|
static char **fgp[] = { &iflags.wc_foregrnd_menu,
|
||||||
&iflags.wc_foregrnd_message,
|
&iflags.wc_foregrnd_message,
|
||||||
@@ -8706,48 +8708,41 @@ wc_set_window_colors(char *op)
|
|||||||
wn = tfg = tbg = (char *) 0;
|
wn = tfg = tbg = (char *) 0;
|
||||||
|
|
||||||
/* until first non-space in case there's leading spaces - before
|
/* until first non-space in case there's leading spaces - before
|
||||||
* colorname*/
|
colorname*/
|
||||||
if (*newop == ' ')
|
if (*newop == ' ')
|
||||||
newop++;
|
newop++;
|
||||||
if (*newop)
|
if (!*newop)
|
||||||
wn = newop;
|
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
|
wn = newop;
|
||||||
|
|
||||||
/* until first space - colorname*/
|
/* until first space - colorname*/
|
||||||
while (*newop && *newop != ' ')
|
while (*newop && *newop != ' ')
|
||||||
newop++;
|
newop++;
|
||||||
if (*newop)
|
if (!*newop)
|
||||||
*newop = '\0';
|
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
newop++;
|
*newop++ = '\0';
|
||||||
|
|
||||||
/* until first non-space - before foreground*/
|
/* until first non-space - before foreground*/
|
||||||
if (*newop == ' ')
|
if (*newop == ' ')
|
||||||
newop++;
|
newop++;
|
||||||
if (*newop)
|
if (!*newop)
|
||||||
tfg = newop;
|
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
|
tfg = newop;
|
||||||
|
|
||||||
/* until slash - foreground */
|
/* until slash - foreground */
|
||||||
while (*newop && *newop != '/')
|
while (*newop && *newop != '/')
|
||||||
newop++;
|
newop++;
|
||||||
if (*newop)
|
if (!*newop)
|
||||||
*newop = '\0';
|
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
newop++;
|
*newop++ = '\0';
|
||||||
|
|
||||||
/* until first non-space (in case there's leading space after slash) -
|
/* until first non-space (in case there's leading space after slash) -
|
||||||
* before background */
|
* before background */
|
||||||
if (*newop == ' ')
|
if (*newop == ' ')
|
||||||
newop++;
|
newop++;
|
||||||
if (*newop)
|
if (!*newop)
|
||||||
tbg = newop;
|
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
|
tbg = newop;
|
||||||
|
|
||||||
/* until first space - background */
|
/* until first space - background */
|
||||||
while (*newop && *newop != ' ')
|
while (*newop && *newop != ' ')
|
||||||
|
|||||||
Reference in New Issue
Block a user