Browse Source

Update template for .c files.

Add section for forward declarations of local functions. This section is
located before file scope variables because functions can be used in
strucutres (see find.c for example):

/*** forward declarations (file scope functions) *************************************************/

/* button callbacks */
static int start_stop (WButton * button, int action);
static int find_do_view_file (WButton * button, int action);
static int find_do_edit_file (WButton * button, int action);

/*** file scope variables ************************************************************************/

static struct
{
    ...
    bcback_fn callback;
} fbuts[] =
{
    ...
    { B_STOP, NORMAL_BUTTON, N_("S&uspend"), 0, 0, NULL, start_stop },
    ...
    { B_VIEW, NORMAL_BUTTON, N_("&View - F3"), 0, 0, NULL, find_do_view_file },
    { B_VIEW, NORMAL_BUTTON, N_("&Edit - F4"), 0, 0, NULL, find_do_edit_file }
};

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Andrew Borodin 2 years ago
parent
commit
7257f794d2

+ 3 - 0
lib/charsets.c

@@ -58,8 +58,11 @@ const char *cp_source = NULL;
 
 /*** file scope type declarations ****************************************************************/
 
+/*** forward declarations (file scope functions) *************************************************/
+
 /*** file scope variables ************************************************************************/
 
+/* --------------------------------------------------------------------------------------------- */
 /*** file scope functions ************************************************************************/
 /* --------------------------------------------------------------------------------------------- */
 

+ 2 - 1
lib/event/manage.c

@@ -38,6 +38,8 @@
 
 /*** file scope type declarations ****************************************************************/
 
+/*** forward declarations (file scope functions) *************************************************/
+
 /*** file scope variables ************************************************************************/
 
 /* --------------------------------------------------------------------------------------------- */
@@ -58,7 +60,6 @@ gboolean
 mc_event_add (const gchar * event_group_name, const gchar * event_name,
               mc_event_callback_func_t event_callback, gpointer event_init_data, GError ** mcerror)
 {
-
     GTree *event_group;
     GPtrArray *callbacks;
     mc_event_callback_t *cb;

+ 27 - 3
lib/filehighlight/get-color.c

@@ -39,10 +39,12 @@
 
 /*** file scope type declarations ****************************************************************/
 
+/*** forward declarations (file scope functions) *************************************************/
+
 /*** file scope variables ************************************************************************/
 
+/* --------------------------------------------------------------------------------------------- */
 /*** file scope functions ************************************************************************/
-
 /* --------------------------------------------------------------------------------------------- */
 
 /*inline functions */
@@ -55,12 +57,16 @@ mc_fhl_is_file (const file_entry_t * fe)
     return S_ISREG (fe->st.st_mode);
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_file_exec (const file_entry_t * fe)
 {
     return is_exe (fe->st.st_mode);
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_dir (const file_entry_t * fe)
 {
@@ -70,6 +76,8 @@ mc_fhl_is_dir (const file_entry_t * fe)
     return S_ISDIR (fe->st.st_mode);
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_link (const file_entry_t * fe)
 {
@@ -79,24 +87,32 @@ mc_fhl_is_link (const file_entry_t * fe)
     return S_ISLNK (fe->st.st_mode);
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_hlink (const file_entry_t * fe)
 {
     return (fe->st.st_nlink > 1);
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_link_to_dir (const file_entry_t * fe)
 {
     return mc_fhl_is_link (fe) && fe->f.link_to_dir;
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_stale_link (const file_entry_t * fe)
 {
     return mc_fhl_is_link (fe) ? fe->f.stale_link : !mc_fhl_is_file (fe);
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_device_char (const file_entry_t * fe)
 {
@@ -106,6 +122,8 @@ mc_fhl_is_device_char (const file_entry_t * fe)
     return S_ISCHR (fe->st.st_mode);
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_device_block (const file_entry_t * fe)
 {
@@ -115,6 +133,8 @@ mc_fhl_is_device_block (const file_entry_t * fe)
     return S_ISBLK (fe->st.st_mode);
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_special_socket (const file_entry_t * fe)
 {
@@ -124,6 +144,8 @@ mc_fhl_is_special_socket (const file_entry_t * fe)
     return S_ISSOCK (fe->st.st_mode);
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_special_fifo (const file_entry_t * fe)
 {
@@ -133,6 +155,8 @@ mc_fhl_is_special_fifo (const file_entry_t * fe)
     return S_ISFIFO (fe->st.st_mode);
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_special_door (const file_entry_t * fe)
 {
@@ -142,6 +166,8 @@ mc_fhl_is_special_door (const file_entry_t * fe)
     return S_ISDOOR (fe->st.st_mode);
 }
 
+/* --------------------------------------------------------------------------------------------- */
+
 inline static gboolean
 mc_fhl_is_special (const file_entry_t * fe)
 {
@@ -246,8 +272,6 @@ mc_fhl_get_color_regexp (const mc_fhl_filter_t * mc_filter, const mc_fhl_t * fhl
     return -1;
 }
 
-/* --------------------------------------------------------------------------------------------- */
-
 /* --------------------------------------------------------------------------------------------- */
 /*** public functions ****************************************************************************/
 /* --------------------------------------------------------------------------------------------- */

+ 2 - 0
lib/filehighlight/ini-file-read.c

@@ -43,6 +43,8 @@
 
 /*** file scope type declarations ****************************************************************/
 
+/*** forward declarations (file scope functions) *************************************************/
+
 /*** file scope variables ************************************************************************/
 
 /* --------------------------------------------------------------------------------------------- */

+ 3 - 0
lib/keybind.c

@@ -51,6 +51,8 @@ typedef struct name_keymap_t
     long val;
 } name_keymap_t;
 
+/*** forward declarations (file scope functions) *************************************************/
+
 /*** file scope variables ************************************************************************/
 
 static name_keymap_t command_names[] = {
@@ -382,6 +384,7 @@ static name_keymap_t command_names[] = {
 static const size_t num_command_names = G_N_ELEMENTS (command_names) - 1;
 /* *INDENT-ON* */
 
+/* --------------------------------------------------------------------------------------------- */
 /*** file scope functions ************************************************************************/
 /* --------------------------------------------------------------------------------------------- */
 

+ 3 - 0
lib/lock.c

@@ -75,8 +75,11 @@ typedef struct
     pid_t pid;
 } lock_s;
 
+/*** forward declarations (file scope functions) *************************************************/
+
 /*** file scope variables ************************************************************************/
 
+/* --------------------------------------------------------------------------------------------- */
 /*** file scope functions ************************************************************************/
 /* --------------------------------------------------------------------------------------------- */
 /** \fn static char * lock_build_name (void)

+ 3 - 0
lib/logging.c

@@ -49,11 +49,14 @@
 
 /*** file scope type declarations ****************************************************************/
 
+/*** forward declarations (file scope functions) *************************************************/
+
 /*** file scope variables ************************************************************************/
 
 static gboolean logging_initialized = FALSE;
 static gboolean logging_enabled = FALSE;
 
+/* --------------------------------------------------------------------------------------------- */
 /*** file scope functions ************************************************************************/
 /* --------------------------------------------------------------------------------------------- */
 

+ 2 - 0
lib/mcconfig/common.c

@@ -39,6 +39,8 @@
 
 /*** file scope type declarations ****************************************************************/
 
+/*** forward declarations (file scope functions) *************************************************/
+
 /*** file scope variables ************************************************************************/
 
 /* --------------------------------------------------------------------------------------------- */

+ 2 - 0
lib/mcconfig/paths.c

@@ -42,6 +42,8 @@
 
 /*** file scope type declarations ****************************************************************/
 
+/*** forward declarations (file scope functions) *************************************************/
+
 /*** file scope variables ************************************************************************/
 
 static gboolean xdg_vars_initialized = FALSE;

+ 2 - 0
lib/mcconfig/set.c

@@ -33,6 +33,8 @@
 
 /*** file scope type declarations ****************************************************************/
 
+/*** forward declarations (file scope functions) *************************************************/
+
 /*** file scope variables ************************************************************************/
 
 /* --------------------------------------------------------------------------------------------- */

Some files were not shown because too many files changed in this diff