Move definition of file_entry_t to separate file.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2023-02-12 13:23:36 +03:00
parent cf223bec27
commit 8fdcbeed74
15 changed files with 65 additions and 24 deletions

View File

@ -32,6 +32,7 @@ SRC_mc_utils = \
libmc_la_SOURCES = \ libmc_la_SOURCES = \
$(SUBLIB_includes) \ $(SUBLIB_includes) \
$(SRC_mc_utils) \ $(SRC_mc_utils) \
file-entry.h \
fileloc.h \ fileloc.h \
fs.h \ fs.h \
hook.c hook.h \ hook.c hook.h \

49
lib/file-entry.h Normal file
View File

@ -0,0 +1,49 @@
/** \file lib/file-entry.h
* \brief Header: file entry definition
*/
#ifndef MC__ILE_ENTRY_H
#define MC__ILE_ENTRY_H
#include <sys/types.h>
#include <sys/stat.h>
#include "lib/global.h" /* include <glib.h> */
/*** typedefs(not structures) and defined constants **********************************************/
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/
/* keys are set only during sorting */
typedef struct
{
/* File name */
GString *fname;
/* File attributes */
struct stat st;
/* Key used for comparing names */
char *sort_key;
/* Key used for comparing extensions */
char *second_sort_key;
/* Flags */
struct
{
unsigned int marked:1; /* File marked in pane window */
unsigned int link_to_dir:1; /* If this is a link, does it point to directory? */
unsigned int stale_link:1; /* If this is a symlink and points to Charon's land */
unsigned int dir_size_computed:1; /* Size of directory was computed with dirsizes_cmd */
} f;
} file_entry_t;
/*** global variables defined in .c file *********************************************************/
/*** declarations of public functions ************************************************************/
/* --------------------------------------------------------------------------------------------- */
/*** inline functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
#endif /* MC__FILE_ENTRY_H */

View File

@ -2,7 +2,7 @@
#define MC__FILEHIGHLIGHT_H #define MC__FILEHIGHLIGHT_H
#include "lib/mcconfig.h" /* mc_config_t */ #include "lib/mcconfig.h" /* mc_config_t */
#include "lib/util.h" /* file_entry_t */ #include "lib/file-entry.h"
/*** typedefs(not structures) and defined constants **********************************************/ /*** typedefs(not structures) and defined constants **********************************************/

View File

@ -27,7 +27,10 @@
#include <config.h> #include <config.h>
#include "lib/global.h" #include "lib/global.h"
#include "lib/util.h" /* MC_PTR_FREE */
#include "lib/filehighlight.h" #include "lib/filehighlight.h"
#include "internal.h" #include "internal.h"
/*** global variables ****************************************************************************/ /*** global variables ****************************************************************************/

View File

@ -122,27 +122,6 @@ typedef struct
/*** structures declarations (and typedefs of structures)*****************************************/ /*** structures declarations (and typedefs of structures)*****************************************/
/* keys are set only during sorting */
typedef struct
{
/* File attributes */
GString *fname;
struct stat st;
/* key used for comparing names */
char *sort_key;
/* key used for comparing extensions */
char *second_sort_key;
/* Flags */
struct
{
unsigned int marked:1; /* File marked in pane window */
unsigned int link_to_dir:1; /* If this is a link, does it point to directory? */
unsigned int stale_link:1; /* If this is a symlink and points to Charon's land */
unsigned int dir_size_computed:1; /* Size of directory was computed with dirsizes_cmd */
} f;
} file_entry_t;
/*** global variables defined in .c file *********************************************************/ /*** global variables defined in .c file *********************************************************/
extern struct sigaction startup_handler; extern struct sigaction startup_handler;

View File

@ -48,6 +48,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "lib/global.h" #include "lib/global.h"
#include "lib/util.h" /* whitespace() */
#include "src/setup.h" /* option_tab_spacing */ #include "src/setup.h" /* option_tab_spacing */

View File

@ -45,6 +45,7 @@
#include "lib/skin.h" /* COLOR_NORMAL, DISABLED_COLOR */ #include "lib/skin.h" /* COLOR_NORMAL, DISABLED_COLOR */
#include "lib/vfs/vfs.h" #include "lib/vfs/vfs.h"
#include "lib/widget.h" #include "lib/widget.h"
#include "lib/util.h" /* x_basename() */
#include "src/keymap.h" /* chattr_map */ #include "src/keymap.h" /* chattr_map */

View File

@ -58,6 +58,7 @@
#include "lib/vfs/vfs.h" #include "lib/vfs/vfs.h"
#include "lib/fileloc.h" #include "lib/fileloc.h"
#include "lib/strutil.h" #include "lib/strutil.h"
#include "lib/file-entry.h"
#include "lib/util.h" #include "lib/util.h"
#include "lib/widget.h" #include "lib/widget.h"
#include "lib/keybind.h" /* CK_Down, CK_History */ #include "lib/keybind.h" /* CK_Down, CK_History */

View File

@ -9,7 +9,7 @@
#include "lib/global.h" #include "lib/global.h"
#include "lib/search.h" #include "lib/search.h"
#include "lib/util.h" #include "lib/file-entry.h"
#include "lib/vfs/vfs.h" #include "lib/vfs/vfs.h"
/*** typedefs(not structures) and defined constants **********************************************/ /*** typedefs(not structures) and defined constants **********************************************/

View File

@ -13,6 +13,7 @@
#include "lib/strutil.h" #include "lib/strutil.h"
#include "lib/widget.h" /* Widget */ #include "lib/widget.h" /* Widget */
#include "lib/filehighlight.h" #include "lib/filehighlight.h"
#include "lib/file-entry.h"
#include "dir.h" /* dir_list */ #include "dir.h" /* dir_list */

View File

@ -39,6 +39,7 @@
#include "lib/mcconfig.h" /* Load/save directories panelize */ #include "lib/mcconfig.h" /* Load/save directories panelize */
#include "lib/strutil.h" #include "lib/strutil.h"
#include "lib/widget.h" #include "lib/widget.h"
#include "lib/util.h" /* mc_pipe_t */
#include "src/history.h" #include "src/history.h"

View File

@ -95,6 +95,7 @@ What to do with this?
#include <inttypes.h> /* uintmax_t */ #include <inttypes.h> /* uintmax_t */
#include "lib/global.h" #include "lib/global.h"
#include "lib/file-entry.h"
#include "lib/util.h" #include "lib/util.h"
#include "lib/strutil.h" /* str_move() */ #include "lib/strutil.h" /* str_move() */
#include "lib/mcconfig.h" #include "lib/mcconfig.h"

View File

@ -52,7 +52,7 @@
#include "lib/tty/tty.h" #include "lib/tty/tty.h"
#include "lib/tty/key.h" /* is_idle() */ #include "lib/tty/key.h" /* is_idle() */
#include "lib/lock.h" /* lock_file() */ #include "lib/lock.h" /* lock_file() */
#include "lib/util.h" #include "lib/file-entry.h"
#include "lib/widget.h" #include "lib/widget.h"
#ifdef HAVE_CHARSET #ifdef HAVE_CHARSET
#include "lib/charsets.h" #include "lib/charsets.h"

View File

@ -11,6 +11,7 @@
#include "lib/search.h" #include "lib/search.h"
#include "lib/widget.h" #include "lib/widget.h"
#include "lib/vfs/vfs.h" /* vfs_path_t */ #include "lib/vfs/vfs.h" /* vfs_path_t */
#include "lib/util.h" /* mc_pipe_t */
#include "src/keymap.h" /* global_keymap_t */ #include "src/keymap.h" /* global_keymap_t */
#include "src/filemanager/dir.h" /* dir_list */ #include "src/filemanager/dir.h" /* dir_list */

View File

@ -27,6 +27,8 @@
#include "tests/mctest.h" #include "tests/mctest.h"
#include "lib/file-entry.h"
#include "src/vfs/local/local.c" #include "src/vfs/local/local.c"
#include "src/filemanager/filemanager.c" #include "src/filemanager/filemanager.c"