Introduction
Introduction Statistics Contact Development Disclaimer Help
Avoid another allocation - noice - small file browser (mirror / fork from 2f30.…
git clone git://git.codemadness.org/noice
Log
Files
Refs
README
LICENSE
---
commit 5fb5e9f82f89a2a9257bd375dfb8d065c5afa7bb
parent fa6b45a96de53621d4e89bd63ee810210712f043
Author: sin <[email protected]>
Date: Wed, 6 Jan 2016 15:55:25 +0000
Avoid another allocation
Diffstat:
M noice.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/noice.c b/noice.c
@@ -423,12 +423,12 @@ canopendir(char *path)
void
printent(struct entry *ent, int active)
{
- char *name;
+ char name[PATH_MAX];
unsigned int maxlen = COLS - strlen(CURSR) - 1;
char cm = 0;
/* Copy name locally */
- name = xstrdup(ent->name);
+ strlcpy(name, ent->name, sizeof(name));
if (S_ISDIR(ent->mode)) {
cm = '/';
@@ -455,8 +455,6 @@ printent(struct entry *ent, int active)
printw("%s%s\n", active ? CURSR : EMPTY, name);
else
printw("%s%s%c\n", active ? CURSR : EMPTY, name, cm);
-
- free(name);
}
int
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.