From 1216f153461893e10ded8007e808da3a62483e7b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 6 Jun 2016 20:16:44 +0200 Subject: next/priv directory: Use PATH_MAX instead of FEH_MAX_DIRNAME_LEN --- src/filelist.c | 6 +++--- src/filelist.h | 1 - src/slideshow.c | 12 ++++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/filelist.c b/src/filelist.c index ebae08d..b569b8a 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -409,10 +409,10 @@ int feh_cmp_name(void *file1, void *file2) int feh_cmp_dirname(void *file1, void *file2) { - char dir1[FEH_MAX_DIRNAME_LEN], dir2[FEH_MAX_DIRNAME_LEN]; + char dir1[PATH_MAX], dir2[PATH_MAX]; int cmp; - feh_file_dirname(dir1, FEH_FILE(file1), FEH_MAX_DIRNAME_LEN); - feh_file_dirname(dir2, FEH_FILE(file2), FEH_MAX_DIRNAME_LEN); + feh_file_dirname(dir1, FEH_FILE(file1), PATH_MAX); + feh_file_dirname(dir2, FEH_FILE(file2), PATH_MAX); if ((cmp = strcmp(dir1, dir2)) != 0) return(cmp); return(feh_cmp_name(file1, file2)); diff --git a/src/filelist.h b/src/filelist.h index 91e5fd0..e24a6a6 100644 --- a/src/filelist.h +++ b/src/filelist.h @@ -53,7 +53,6 @@ struct __feh_file_info { }; #define FEH_FILE(l) ((feh_file *) l) -#define FEH_MAX_DIRNAME_LEN 4096 /* * PATH_MAX may not be defined on all systems. Since we only use it in for a diff --git a/src/slideshow.c b/src/slideshow.c index 2af78c9..7ff4f39 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -324,14 +324,14 @@ void slideshow_change_image(winwidget winwid, int change, int render) break; case SLIDE_JUMP_NEXT_DIR: { - char old_dir[FEH_MAX_DIRNAME_LEN], new_dir[FEH_MAX_DIRNAME_LEN]; + char old_dir[PATH_MAX], new_dir[PATH_MAX]; int j; - feh_file_dirname(old_dir, FEH_FILE(current_file->data), FEH_MAX_DIRNAME_LEN); + feh_file_dirname(old_dir, FEH_FILE(current_file->data), PATH_MAX); for (j = 0; j < our_filelist_len; j++) { current_file = feh_list_jump(filelist, current_file, FORWARD, 1); - feh_file_dirname(new_dir, FEH_FILE(current_file->data), FEH_MAX_DIRNAME_LEN); + feh_file_dirname(new_dir, FEH_FILE(current_file->data), PATH_MAX); if (strcmp(old_dir, new_dir) != 0) break; } @@ -340,17 +340,17 @@ void slideshow_change_image(winwidget winwid, int change, int render) break; case SLIDE_JUMP_PREV_DIR: { - char old_dir[FEH_MAX_DIRNAME_LEN], new_dir[FEH_MAX_DIRNAME_LEN]; + char old_dir[PATH_MAX], new_dir[PATH_MAX]; int j; /* Start the search from the previous file in case we are on the first file of a directory */ current_file = feh_list_jump(filelist, current_file, BACK, 1); - feh_file_dirname(old_dir, FEH_FILE(current_file->data), FEH_MAX_DIRNAME_LEN); + feh_file_dirname(old_dir, FEH_FILE(current_file->data), PATH_MAX); for (j = 0; j < our_filelist_len; j++) { current_file = feh_list_jump(filelist, current_file, BACK, 1); - feh_file_dirname(new_dir, FEH_FILE(current_file->data), FEH_MAX_DIRNAME_LEN); + feh_file_dirname(new_dir, FEH_FILE(current_file->data), PATH_MAX); if (strcmp(old_dir, new_dir) != 0) break; } -- cgit v1.2.3