mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Reduce late assignments
This commit is contained in:
parent
e075b98cfe
commit
b5654e3188
20
src/nnn.c
20
src/nnn.c
|
@ -3670,17 +3670,25 @@ static char get_detail_ind(const mode_t mode)
|
||||||
return '?';
|
return '?';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Note: attribute and indicator values must be initialized to 0 */
|
||||||
static uchar_t get_color_pair_name_ind(const struct entry *ent, char *pind, int *pattr)
|
static uchar_t get_color_pair_name_ind(const struct entry *ent, char *pind, int *pattr)
|
||||||
{
|
{
|
||||||
switch (ent->mode & S_IFMT) {
|
switch (ent->mode & S_IFMT) {
|
||||||
case S_IFREG:
|
case S_IFREG:
|
||||||
*pind = (ent->mode & 0100) ? '*' : '\0';
|
if (!ent->size) {
|
||||||
if (!ent->size)
|
if (ent->mode & 0100)
|
||||||
|
*pind = '*';
|
||||||
return C_UND;
|
return C_UND;
|
||||||
if (ent->flags & HARD_LINK)
|
}
|
||||||
|
if (ent->flags & HARD_LINK) {
|
||||||
|
if (ent->mode & 0100)
|
||||||
|
*pind = '*';
|
||||||
return C_HRD;
|
return C_HRD;
|
||||||
if (ent->mode & 0100)
|
}
|
||||||
|
if (ent->mode & 0100) {
|
||||||
|
*pind = '*';
|
||||||
return C_EXE;
|
return C_EXE;
|
||||||
|
}
|
||||||
return C_FIL;
|
return C_FIL;
|
||||||
case S_IFDIR:
|
case S_IFDIR:
|
||||||
*pind = '/';
|
*pind = '/';
|
||||||
|
@ -3707,10 +3715,8 @@ static uchar_t get_color_pair_name_ind(const struct entry *ent, char *pind, int
|
||||||
*pind = '|';
|
*pind = '|';
|
||||||
return C_PIP;
|
return C_PIP;
|
||||||
case S_IFBLK:
|
case S_IFBLK:
|
||||||
*pind = '\0';
|
|
||||||
return C_BLK;
|
return C_BLK;
|
||||||
case S_IFCHR:
|
case S_IFCHR:
|
||||||
*pind = '\0';
|
|
||||||
return C_CHR;
|
return C_CHR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3720,7 +3726,7 @@ static uchar_t get_color_pair_name_ind(const struct entry *ent, char *pind, int
|
||||||
|
|
||||||
static void printent(const struct entry *ent, uint_t namecols, bool sel)
|
static void printent(const struct entry *ent, uint_t namecols, bool sel)
|
||||||
{
|
{
|
||||||
char ind;
|
char ind = '\0';
|
||||||
int attrs = 0;
|
int attrs = 0;
|
||||||
uchar_t color_pair = get_color_pair_name_ind(ent, &ind, &attrs);
|
uchar_t color_pair = get_color_pair_name_ind(ent, &ind, &attrs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue