mirror of
https://github.com/jarun/nnn.git
synced 2025-02-03 06:46:34 +00:00
Avoid another allocation
This commit is contained in:
parent
fa6b45a96d
commit
5fb5e9f82f
6
noice.c
6
noice.c
|
@ -423,12 +423,12 @@ canopendir(char *path)
|
||||||
void
|
void
|
||||||
printent(struct entry *ent, int active)
|
printent(struct entry *ent, int active)
|
||||||
{
|
{
|
||||||
char *name;
|
char name[PATH_MAX];
|
||||||
unsigned int maxlen = COLS - strlen(CURSR) - 1;
|
unsigned int maxlen = COLS - strlen(CURSR) - 1;
|
||||||
char cm = 0;
|
char cm = 0;
|
||||||
|
|
||||||
/* Copy name locally */
|
/* Copy name locally */
|
||||||
name = xstrdup(ent->name);
|
strlcpy(name, ent->name, sizeof(name));
|
||||||
|
|
||||||
if (S_ISDIR(ent->mode)) {
|
if (S_ISDIR(ent->mode)) {
|
||||||
cm = '/';
|
cm = '/';
|
||||||
|
@ -455,8 +455,6 @@ printent(struct entry *ent, int active)
|
||||||
printw("%s%s\n", active ? CURSR : EMPTY, name);
|
printw("%s%s\n", active ? CURSR : EMPTY, name);
|
||||||
else
|
else
|
||||||
printw("%s%s%c\n", active ? CURSR : EMPTY, name, cm);
|
printw("%s%s%c\n", active ? CURSR : EMPTY, name, cm);
|
||||||
|
|
||||||
free(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in a new issue