Remove loop for printing spaces

This commit is contained in:
Arun Prakash Jana 2021-04-06 16:25:02 +05:30
parent 0223d53584
commit edacfcc828
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -3742,14 +3742,13 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
static void print_details(const struct entry *ent) static void print_details(const struct entry *ent)
{ {
int entry_type = ent->mode & S_IFMT; int entry_type = ent->mode & S_IFMT;
char *size; const char blanks[9] = " ";
uint_t len;
/* Directories are always shown on top */ /* Directories are always shown on top */
resetdircolor(ent->flags); resetdircolor(ent->flags);
print_time(&ent->t); print_time(&ent->t);
addstr(" "); addstr(blanks + sizeof(blanks) - 3);
/* Permissions */ /* Permissions */
addch('0' + ((ent->mode >> 6) & 7)); addch('0' + ((ent->mode >> 6) & 7));
@ -3757,13 +3756,11 @@ static void print_details(const struct entry *ent)
addch('0' + (ent->mode & 7)); addch('0' + (ent->mode & 7));
if (entry_type == S_IFREG || entry_type == S_IFDIR) { if (entry_type == S_IFREG || entry_type == S_IFDIR) {
size = coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size); char *size = coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size);
len = 10 - (uint_t)xstrlen(size); addstr(blanks + (uint_t)xstrlen(size) - 1);
while (--len)
addch(' ');
addstr(size); addstr(size);
} else { } else {
addstr(" "); addstr(blanks);
addch(get_detail_ind(ent->mode)); addch(get_detail_ind(ent->mode));
} }
} }