Skip to content
Snippets Groups Projects
Commit e3808059 authored by Yorhel's avatar Yorhel
Browse files

Fixed some compiler warnings and a (rather nonexistent) memory leak

This silences clang and gcc with -O2 -Wall -Wextra
parent 5064b4d6
No related branches found
No related tags found
No related merge requests found
...@@ -152,7 +152,7 @@ static void browse_draw_item(struct dir *n, int row) { ...@@ -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) { ...@@ -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() { ...@@ -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) { ...@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment