mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
Fixed some compiler warnings and a (rather nonexistent) memory leak
This silences clang and gcc with -O2 -Wall -Wextra
This commit is contained in:
parent
5064b4d651
commit
e380805990
4 changed files with 7 additions and 5 deletions
|
|
@ -152,7 +152,7 @@ static void browse_draw_item(struct dir *n, int row) {
|
||||||
void browse_draw() {
|
void browse_draw() {
|
||||||
struct dir *t;
|
struct dir *t;
|
||||||
char fmtsize[9], *tmp;
|
char fmtsize[9], *tmp;
|
||||||
int selected, i;
|
int selected = 0, i;
|
||||||
|
|
||||||
erase();
|
erase();
|
||||||
t = dirlist_get(0);
|
t = dirlist_get(0);
|
||||||
|
|
|
||||||
|
|
@ -119,9 +119,9 @@ struct dir *dir_createstruct(const char *name) {
|
||||||
|
|
||||||
static void draw_progress() {
|
static void draw_progress() {
|
||||||
static const char antext[] = "Scanning...";
|
static const char antext[] = "Scanning...";
|
||||||
static int anpos = 0;
|
static size_t anpos = 0;
|
||||||
char ani[20] = {};
|
char ani[20] = {};
|
||||||
int i;
|
size_t i;
|
||||||
int width = wincols-5;
|
int width = wincols-5;
|
||||||
|
|
||||||
nccreate(10, width, "Scanning...");
|
nccreate(10, width, "Scanning...");
|
||||||
|
|
|
||||||
|
|
@ -248,8 +248,10 @@ int dir_scan_process() {
|
||||||
dir_seterr("Error reading directory: %s", strerror(errno));
|
dir_seterr("Error reading directory: %s", strerror(errno));
|
||||||
|
|
||||||
/* Special case: empty directory = error */
|
/* Special case: empty directory = error */
|
||||||
if(!dir_fatalerr && !*dir)
|
if(!dir_fatalerr && !*dir) {
|
||||||
dir_seterr("Directory empty");
|
dir_seterr("Directory empty");
|
||||||
|
free(dir);
|
||||||
|
}
|
||||||
|
|
||||||
if(!dir_fatalerr) {
|
if(!dir_fatalerr) {
|
||||||
curdev = fs.st_dev;
|
curdev = fs.st_dev;
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ static char *path_absolute(const char *path) {
|
||||||
/* NOTE: cwd and the memory cur points to are unreliable after calling this function */
|
/* NOTE: cwd and the memory cur points to are unreliable after calling this function */
|
||||||
static char *path_real_rec(char *cur, int *links) {
|
static char *path_real_rec(char *cur, int *links) {
|
||||||
int i, n, tmpl, lnkl = 0;
|
int i, n, tmpl, lnkl = 0;
|
||||||
char **arr, *tmp, *lnk, *ret = NULL;
|
char **arr, *tmp, *lnk = NULL, *ret = NULL;
|
||||||
|
|
||||||
tmpl = strlen(cur)+1;
|
tmpl = strlen(cur)+1;
|
||||||
tmp = malloc(tmpl);
|
tmp = malloc(tmpl);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue