Просмотр исходного кода

Code indentation in lib directory

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Slava Zanko 14 лет назад
Родитель
Сommit
feb733663f

+ 3 - 1
lib/filehighlight.h

@@ -11,7 +11,8 @@
 
 /*** structures declarations (and typedefs of structures)*****************************************/
 
-typedef struct mc_fhl_struct {
+typedef struct mc_fhl_struct
+{
     mc_config_t *config;
     GPtrArray *filters;
 } mc_fhl_t;
@@ -29,4 +30,5 @@ gboolean mc_fhl_read_ini_file (mc_fhl_t *, const gchar *);
 gboolean mc_fhl_parse_ini_file (mc_fhl_t *);
 void mc_fhl_clear (mc_fhl_t *);
 
+/*** inline functions ****************************************************************************/
 #endif

+ 4 - 2
lib/filehighlight/common.c

@@ -82,12 +82,14 @@ mc_fhl_new (gboolean need_auto_fill)
     if (!need_auto_fill)
         return fhl;
 
-    if (!mc_fhl_init_from_standard_files (fhl)) {
+    if (!mc_fhl_init_from_standard_files (fhl))
+    {
         g_free (fhl);
         return NULL;
     }
 
-    if (!mc_fhl_parse_ini_file (fhl)) {
+    if (!mc_fhl_parse_ini_file (fhl))
+    {
         mc_fhl_free (&fhl);
         return NULL;
     }

+ 9 - 6
lib/filehighlight/get-color.c

@@ -44,7 +44,7 @@
 
 /*** file scope functions ************************************************************************/
 /* --------------------------------------------------------------------------------------------- */
-/*inline functions*/
+/*inline functions */
 inline static gboolean
 mc_fhl_is_file (file_entry * fe)
 {
@@ -141,8 +141,8 @@ inline static gboolean
 mc_fhl_is_special (file_entry * fe)
 {
     return
-        (mc_fhl_is_special_socket (fe) || mc_fhl_is_special_fifo (fe) || mc_fhl_is_special_door (fe)
-        );
+        (mc_fhl_is_special_socket (fe) || mc_fhl_is_special_fifo (fe)
+         || mc_fhl_is_special_door (fe));
 }
 
 
@@ -154,7 +154,8 @@ mc_fhl_get_color_filetype (mc_fhl_filter_t * mc_filter, mc_fhl_t * fhl, file_ent
     gboolean my_color = FALSE;
     (void) fhl;
 
-    switch (mc_filter->file_type) {
+    switch (mc_filter->file_type)
+    {
     case MC_FLHGH_FTYPE_T_FILE:
         if (mc_fhl_is_file (fe))
             my_color = TRUE;
@@ -254,9 +255,11 @@ mc_fhl_get_color (mc_fhl_t * fhl, file_entry * fe)
     if (fhl == NULL)
         return NORMAL_COLOR;
 
-    for (i = 0; i < fhl->filters->len; i++) {
+    for (i = 0; i < fhl->filters->len; i++)
+    {
         mc_filter = (mc_fhl_filter_t *) g_ptr_array_index (fhl->filters, i);
-        switch (mc_filter->type) {
+        switch (mc_filter->type)
+        {
         case MC_FLHGH_T_FTYPE:
             ret = mc_fhl_get_color_filetype (mc_filter, fhl, fe);
             if (ret > 0)

+ 20 - 10
lib/filehighlight/ini-file-read.c

@@ -77,12 +77,14 @@ mc_fhl_parse_get_file_type_id (mc_fhl_t * fhl, const gchar * group_name)
     int i;
     gchar *param_type = mc_config_get_string (fhl->config, group_name, "type", "");
 
-    if (*param_type == '\0') {
+    if (*param_type == '\0')
+    {
         g_free (param_type);
         return FALSE;
     }
 
-    for (i = 0; types[i] != NULL; i++) {
+    for (i = 0; types[i] != NULL; i++)
+    {
         if (strcmp (types[i], param_type) == 0)
             break;
     }
@@ -107,7 +109,8 @@ mc_fhl_parse_get_regexp (mc_fhl_t * fhl, const gchar * group_name)
     mc_fhl_filter_t *mc_filter;
     gchar *regexp = mc_config_get_string (fhl->config, group_name, "regexp", "");
 
-    if (*regexp == '\0') {
+    if (*regexp == '\0')
+    {
         g_free (regexp);
         return FALSE;
     }
@@ -201,7 +204,8 @@ mc_fhl_init_from_standard_files (mc_fhl_t * fhl)
 
     /* ${datadir}/mc/filehighlight.ini  */
     name = concat_dir_and_file (mc_home_alt, MC_FHL_INI_FILE);
-    if (exist_file (name) && (!mc_fhl_read_ini_file (fhl, name))) {
+    if (exist_file (name) && (!mc_fhl_read_ini_file (fhl, name)))
+    {
         g_free (name);
         return FALSE;
     }
@@ -209,7 +213,8 @@ mc_fhl_init_from_standard_files (mc_fhl_t * fhl)
 
     /* ${sysconfdir}/mc/filehighlight.ini  */
     name = concat_dir_and_file (mc_home, MC_FHL_INI_FILE);
-    if (exist_file (name) && (!mc_fhl_read_ini_file (fhl, name))) {
+    if (exist_file (name) && (!mc_fhl_read_ini_file (fhl, name)))
+    {
         g_free (name);
         return FALSE;
     }
@@ -218,7 +223,8 @@ mc_fhl_init_from_standard_files (mc_fhl_t * fhl)
     /* ~/.mc/filehighlight.ini */
     name = g_build_filename (home_dir, MC_USERCONF_DIR, MC_FHL_INI_FILE, NULL);
 
-    if (exist_file (name) && (!mc_fhl_read_ini_file (fhl, name))) {
+    if (exist_file (name) && (!mc_fhl_read_ini_file (fhl, name)))
+    {
         g_free (name);
         return FALSE;
     }
@@ -242,17 +248,21 @@ mc_fhl_parse_ini_file (mc_fhl_t * fhl)
     if (group_names == NULL)
         return FALSE;
 
-    while (*group_names) {
+    while (*group_names)
+    {
 
-        if (mc_config_has_param (fhl->config, *group_names, "type")) {
+        if (mc_config_has_param (fhl->config, *group_names, "type"))
+        {
             /* parse filetype filter */
             mc_fhl_parse_get_file_type_id (fhl, *group_names);
         }
-        if (mc_config_has_param (fhl->config, *group_names, "regexp")) {
+        if (mc_config_has_param (fhl->config, *group_names, "regexp"))
+        {
             /* parse regexp filter */
             mc_fhl_parse_get_regexp (fhl, *group_names);
         }
-        if (mc_config_has_param (fhl->config, *group_names, "extensions")) {
+        if (mc_config_has_param (fhl->config, *group_names, "extensions"))
+        {
             /* parse extensions filter */
             mc_fhl_parse_get_extensions (fhl, *group_names);
         }

+ 7 - 4
lib/filehighlight/internal.h

@@ -5,13 +5,15 @@
 
 /*** enums ***************************************************************************************/
 
-typedef enum {
+typedef enum
+{
     MC_FLHGH_T_FTYPE,
     MC_FLHGH_T_EXT,
     MC_FLHGH_T_FREGEXP
 } mc_flhgh_filter_type;
 
-typedef enum {
+typedef enum
+{
     MC_FLHGH_FTYPE_T_FILE,
     MC_FLHGH_FTYPE_T_FILE_EXE,
     MC_FLHGH_FTYPE_T_DIR,
@@ -31,7 +33,8 @@ typedef enum {
 
 /*** structures declarations (and typedefs of structures)*****************************************/
 
-typedef struct mc_fhl_filter_struct {
+typedef struct mc_fhl_filter_struct
+{
 
     int color_pair_index;
     gchar *fgcolor;
@@ -51,5 +54,5 @@ void mc_fhl_array_free (mc_fhl_t *);
 
 gboolean mc_fhl_init_from_standard_files (mc_fhl_t *);
 
-
+/*** inline functions ****************************************************************************/
 #endif

+ 63 - 53
lib/fileloc.h

@@ -1,4 +1,3 @@
-
 /** \file  fileloc.h
  *  \brief Header: config files list
  *
@@ -14,65 +13,76 @@
 #ifndef MC_FILELOC_H
 #define MC_FILELOC_H
 
+/*** typedefs(not structures) and defined constants **********************************************/
+
 #ifndef MC_USERCONF_DIR
-#define MC_USERCONF_DIR		".mc"
+#define MC_USERCONF_DIR         ".mc"
 #endif
 
+#define TAGS_NAME               "TAGS"
+
+#define MC_GLOBAL_CONFIG_FILE   "mc.lib"
+#define MC_GLOBAL_MENU          "mc.menu"
+#define MC_LOCAL_MENU           ".mc.menu"
+#define MC_HINT                 "hints" PATH_SEP_STR "mc.hint"
+#define MC_HELP                 "help" PATH_SEP_STR "mc.hlp"
+#define GLOBAL_KEYMAP_FILE      "mc.keymap"
+#define CHARSETS_LIST           "mc.charsets"
+#define MC_LIB_EXT              "mc.ext"
+
+#define FISH_PREFIX             "fish"
+
+#define FISH_LS_FILE            "ls"
+#define FISH_EXISTS_FILE        "fexists"
+#define FISH_MKDIR_FILE         "mkdir"
+#define FISH_UNLINK_FILE        "unlink"
+#define FISH_CHOWN_FILE         "chown"
+#define FISH_CHMOD_FILE         "chmod"
+#define FISH_RMDIR_FILE         "rmdir"
+#define FISH_LN_FILE            "ln"
+#define FISH_MV_FILE            "mv"
+#define FISH_HARDLINK_FILE      "hardlink"
+#define FISH_GET_FILE           "get"
+#define FISH_SEND_FILE          "send"
+#define FISH_APPEND_FILE        "append"
+#define FISH_INFO_FILE          "info"
+
+#define MC_EXTFS_DIR            "extfs.d"
 
-#define TAGS_NAME		"TAGS"
-
-#define MC_GLOBAL_CONFIG_FILE	"mc.lib"
-#define MC_GLOBAL_MENU		"mc.menu"
-#define MC_LOCAL_MENU		".mc.menu"
-#define MC_HINT			"hints" PATH_SEP_STR "mc.hint"
-#define MC_HELP			"help" PATH_SEP_STR "mc.hlp"
-#define GLOBAL_KEYMAP_FILE	"mc.keymap"
-#define CHARSETS_LIST		"mc.charsets"
-#define MC_LIB_EXT		"mc.ext"
-
-#define FISH_PREFIX		"fish"
-
-#define FISH_LS_FILE		"ls"
-#define FISH_EXISTS_FILE	"fexists"
-#define FISH_MKDIR_FILE		"mkdir"
-#define FISH_UNLINK_FILE	"unlink"
-#define FISH_CHOWN_FILE		"chown"
-#define FISH_CHMOD_FILE		"chmod"
-#define FISH_RMDIR_FILE		"rmdir"
-#define FISH_LN_FILE		"ln"
-#define FISH_MV_FILE		"mv"
-#define FISH_HARDLINK_FILE	"hardlink"
-#define FISH_GET_FILE		"get"
-#define FISH_SEND_FILE		"send"
-#define FISH_APPEND_FILE	"append"
-#define FISH_INFO_FILE		"info"
-
-#define MC_EXTFS_DIR		"extfs.d"
-
-#define MC_BASHRC_FILE		"bashrc"
-#define MC_CONFIG_FILE		"ini"
-#define MC_FILEBIND_FILE	"bindings"
-#define MC_FILEPOS_FILE		"filepos"
-#define MC_HISTORY_FILE		"history"
-#define MC_HOTLIST_FILE		"hotlist"
-#define MC_USERMENU_FILE	"menu"
-#define MC_TREESTORE_FILE	"Tree"
-#define MC_PANELS_FILE		"panels.ini"
-#define MC_FHL_INI_FILE		"filehighlight.ini"
-#define MC_SKINS_SUBDIR		"skins"
+#define MC_BASHRC_FILE          "bashrc"
+#define MC_CONFIG_FILE          "ini"
+#define MC_FILEBIND_FILE        "bindings"
+#define MC_FILEPOS_FILE         "filepos"
+#define MC_HISTORY_FILE         "history"
+#define MC_HOTLIST_FILE         "hotlist"
+#define MC_USERMENU_FILE        "menu"
+#define MC_TREESTORE_FILE       "Tree"
+#define MC_PANELS_FILE          "panels.ini"
+#define MC_FHL_INI_FILE         "filehighlight.ini"
+#define MC_SKINS_SUBDIR         "skins"
 
 /* editor home directory */
-#define EDIT_DIR		MC_USERCONF_DIR PATH_SEP_STR "cedit"
+#define EDIT_DIR                MC_USERCONF_DIR PATH_SEP_STR "cedit"
 
 /* file names */
-#define EDIT_SYNTAX_FILE	EDIT_DIR PATH_SEP_STR "Syntax"
-#define EDIT_CLIP_FILE		EDIT_DIR PATH_SEP_STR "cooledit.clip"
-#define EDIT_MACRO_FILE		EDIT_DIR PATH_SEP_STR "cooledit.macros"
-#define EDIT_BLOCK_FILE		EDIT_DIR PATH_SEP_STR "cooledit.block"
-#define EDIT_TEMP_FILE		EDIT_DIR PATH_SEP_STR "cooledit.temp"
-
-#define EDIT_GLOBAL_MENU	"cedit.menu"
-#define EDIT_LOCAL_MENU		".cedit.menu"
-#define EDIT_HOME_MENU		EDIT_DIR PATH_SEP_STR "menu"
+#define EDIT_SYNTAX_FILE        EDIT_DIR PATH_SEP_STR "Syntax"
+#define EDIT_CLIP_FILE          EDIT_DIR PATH_SEP_STR "cooledit.clip"
+#define EDIT_MACRO_FILE         EDIT_DIR PATH_SEP_STR "cooledit.macros"
+#define EDIT_BLOCK_FILE         EDIT_DIR PATH_SEP_STR "cooledit.block"
+#define EDIT_TEMP_FILE          EDIT_DIR PATH_SEP_STR "cooledit.temp"
+
+#define EDIT_GLOBAL_MENU        "cedit.menu"
+#define EDIT_LOCAL_MENU         ".cedit.menu"
+#define EDIT_HOME_MENU          EDIT_DIR PATH_SEP_STR "menu"
+
+/*** enums ***************************************************************************************/
+
+/*** structures declarations (and typedefs of structures)*****************************************/
+
+/*** global variables defined in .c file *********************************************************/
+
+/*** declarations of public functions ************************************************************/
+
+/*** inline functions ****************************************************************************/
 
 #endif

+ 12 - 2
lib/fs.h

@@ -1,4 +1,3 @@
-
 /** \file fs.h
  *  \brief Header: fs compatibility definitions
  */
@@ -11,7 +10,9 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#include <dirent.h>
 
+/*** typedefs(not structures) and defined constants **********************************************/
 
 /* Replacement for permission bits missing in sys/stat.h */
 #ifndef S_ISLNK
@@ -52,7 +53,6 @@
 #endif
 
 /* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
-#include <dirent.h>
 #define NLENGTH(dirent) (strlen ((dirent)->d_name))
 #define DIRENT_LENGTH_COMPUTED 1
 
@@ -62,6 +62,16 @@
 #   define MC_MAXFILENAMELEN MAXNAMLEN
 #endif
 
+/*** enums ***************************************************************************************/
+
+/*** structures declarations (and typedefs of structures)*****************************************/
+
+/*** global variables defined in .c file *********************************************************/
+
+/*** declarations of public functions ************************************************************/
+
+/*** inline functions ****************************************************************************/
+
 static inline void
 compute_namelen (struct dirent *dent __attribute__ ((unused)))
 {

+ 5 - 5
lib/glibcompat.c

@@ -21,7 +21,7 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    MA 02110-1301, USA.
-*/
+ */
 
 /** \file glibcompat.c
  *  \brief Source: compatibility with older versions of glib
@@ -50,10 +50,10 @@
 
 #if ! GLIB_CHECK_VERSION (2, 13, 0)
 /*
-    This is incomplete copy of same glib-function.
-    For older glib (less than 2.13) functional is enought.
-    For full version of glib welcome to glib update.
-*/
+   This is incomplete copy of same glib-function.
+   For older glib (less than 2.13) functional is enought.
+   For full version of glib welcome to glib update.
+ */
 gboolean
 g_unichar_iszerowidth (gunichar c)
 {

+ 1 - 0
lib/glibcompat.h

@@ -19,5 +19,6 @@ gboolean g_unichar_iszerowidth (gunichar);
 gboolean g_file_set_contents (const gchar *, const gchar *, gssize, GError **);
 #endif /* ! GLIB_CHECK_VERSION (2, 7, 0) */
 
+/*** inline functions ****************************************************************************/
 
 #endif /* MC_GLIBCOMPAT_H */

+ 55 - 46
lib/global.h

@@ -1,47 +1,47 @@
-
 /** \file global.h
  *  \brief Header: %global definitions for compatibility
  *
  *  This file should be included after all system includes and before all local includes.
  */
 
-
 #ifndef MC_GLOBAL_H
 #define MC_GLOBAL_H
 
 #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
-#  include <string.h>
+#include <string.h>
    /* An ANSI string.h and pre-ANSI memory.h might conflict */
-#  if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
-#    include <memory.h>
-#  endif /* !STDC_HEADERS & HAVE_MEMORY_H */
+#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
+#include <memory.h>
+#endif /* !STDC_HEADERS & HAVE_MEMORY_H */
 
 #else /* !STDC_HEADERS & !HAVE_STRING_H */
-#  include <strings.h>
+#include <strings.h>
     /* memory and strings.h conflict on other systems */
 #endif /* !STDC_HEADERS & !HAVE_STRING_H */
 
 #ifdef HAVE_SYS_PARAM_H
-#  include <sys/param.h>
+#include <sys/param.h>
 #endif
 
+/*** typedefs(not structures) and defined constants **********************************************/
+
 /* The O_BINARY definition was taken from gettext */
 #if !defined O_BINARY && defined _O_BINARY
   /* For MSC-compatible compilers.  */
-#  define O_BINARY _O_BINARY
+#define O_BINARY _O_BINARY
 #endif
 #ifdef __BEOS__
   /* BeOS 5 has O_BINARY, but is has no effect.  */
-#  undef O_BINARY
+#undef O_BINARY
 #endif
 /* On reasonable systems, binary I/O is the default.  */
 #ifndef O_BINARY
-#  define O_BINARY 0
+#define O_BINARY 0
 #endif
 
 /* Replacement for O_NONBLOCK */
 #ifndef O_NONBLOCK
-#ifdef O_NDELAY /* SYSV */
+#ifdef O_NDELAY                 /* SYSV */
 #define O_NONBLOCK O_NDELAY
 #else /* BSD */
 #define O_NONBLOCK FNDELAY
@@ -49,38 +49,38 @@
 #endif /* !O_NONBLOCK */
 
 #ifdef HAVE_SYS_SELECT_H
-#  include <sys/select.h>
+#include <sys/select.h>
 #endif
 
 #if defined(__QNX__) && !defined(__QNXNTO__)
 /* exec*() from <process.h> */
-#  include <unix.h>
+#include <unix.h>
 #endif
 
 #include <glib.h>
 #include "glibcompat.h"
 
 #ifndef __GNUC__
-#  define __attribute__(x)
+#define __attribute__(x)
 #endif
 
 #ifdef ENABLE_NLS
-#   include <libintl.h>
-#   define _(String) gettext (String)
-#   ifdef gettext_noop
-#	define N_(String) gettext_noop (String)
-#   else
-#	define N_(String) (String)
-#   endif
+#include <libintl.h>
+#define _(String) gettext (String)
+#ifdef gettext_noop
+#define N_(String) gettext_noop (String)
+#else
+#define N_(String) (String)
+#endif
 #else /* Stubs that do something close enough.  */
-#   define textdomain(String)
-#   define gettext(String) (String)
-#   define ngettext(String1,String2,Num) (((Num) == 1) ? (String1) : (String2))
-#   define dgettext(Domain,Message) (Message)
-#   define dcgettext(Domain,Message,Type) (Message)
-#   define bindtextdomain(Domain,Directory)
-#   define _(String) (String)
-#   define N_(String) (String)
+#define textdomain(String)
+#define gettext(String) (String)
+#define ngettext(String1,String2,Num) (((Num) == 1) ? (String1) : (String2))
+#define dgettext(Domain,Message) (Message)
+#define dcgettext(Domain,Message,Type) (Message)
+#define bindtextdomain(Domain,Directory)
+#define _(String) (String)
+#define N_(String) (String)
 #endif /* !ENABLE_NLS */
 
 #include "fs.h"
@@ -90,8 +90,6 @@
 #include "lib/logging.h"
 #endif
 
-extern const char *home_dir;
-
 #ifdef min
 #undef min
 #endif
@@ -100,21 +98,19 @@ extern const char *home_dir;
 #undef max
 #endif
 
-#define min(x, y)	((x) > (y) ? (y) : (x))
-#define max(x, y)	((x) > (y) ? (x) : (y))
+#define min(x, y) ((x) > (y) ? (y) : (x))
+#define max(x, y) ((x) > (y) ? (x) : (y))
 
 /* Just for keeping Your's brains from invention a proper size of the buffer :-) */
-#define BUF_10K		10240L
-#define BUF_8K		8192L
-#define BUF_4K		4096L
-#define BUF_1K		1024L
+#define BUF_10K 10240L
+#define BUF_8K  8192L
+#define BUF_4K  4096L
+#define BUF_1K  1024L
 
-#define BUF_LARGE	BUF_1K
-#define BUF_MEDIUM	512
-#define BUF_SMALL	128
-#define BUF_TINY	64
-
-void refresh_screen (void *);
+#define BUF_LARGE  BUF_1K
+#define BUF_MEDIUM 512
+#define BUF_SMALL 128
+#define BUF_TINY 64
 
 /* AIX compiler doesn't understand '\e' */
 #define ESC_CHAR '\033'
@@ -125,14 +121,27 @@ void refresh_screen (void *);
 
 #if 0
 #ifdef MC_ENABLE_DEBUGGING_CODE
-# undef NDEBUG
+#undef NDEBUG
 #else
-# define NDEBUG
+#define NDEBUG
 #endif
 #include <assert.h>
 #endif
 
 #define MC_ERROR mc_main_error_quark ()
+
+/*** enums ***************************************************************************************/
+
+/*** structures declarations (and typedefs of structures)*****************************************/
+
+/*** global variables defined in .c file *********************************************************/
+
+extern const char *home_dir;
+
+/*** declarations of public functions ************************************************************/
+
+void refresh_screen (void *);
 GQuark mc_main_error_quark (void);
 
+/*** inline functions ****************************************************************************/
 #endif

Некоторые файлы не были показаны из-за большого количества измененных файлов