Skip to content

Commit 7257f79

Browse files
committed
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 <[email protected]>
1 parent e1ff8d9 commit 7257f79

File tree

155 files changed

+499
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+499
-132
lines changed

lib/charsets.c

+3
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ const char *cp_source = NULL;
5858

5959
/*** file scope type declarations ****************************************************************/
6060

61+
/*** forward declarations (file scope functions) *************************************************/
62+
6163
/*** file scope variables ************************************************************************/
6264

65+
/* --------------------------------------------------------------------------------------------- */
6366
/*** file scope functions ************************************************************************/
6467
/* --------------------------------------------------------------------------------------------- */
6568

lib/event/manage.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
/*** file scope type declarations ****************************************************************/
4040

41+
/*** forward declarations (file scope functions) *************************************************/
42+
4143
/*** file scope variables ************************************************************************/
4244

4345
/* --------------------------------------------------------------------------------------------- */
@@ -58,7 +60,6 @@ gboolean
5860
mc_event_add (const gchar * event_group_name, const gchar * event_name,
5961
mc_event_callback_func_t event_callback, gpointer event_init_data, GError ** mcerror)
6062
{
61-
6263
GTree *event_group;
6364
GPtrArray *callbacks;
6465
mc_event_callback_t *cb;

lib/filehighlight/get-color.c

+27-3
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@
3939

4040
/*** file scope type declarations ****************************************************************/
4141

42+
/*** forward declarations (file scope functions) *************************************************/
43+
4244
/*** file scope variables ************************************************************************/
4345

46+
/* --------------------------------------------------------------------------------------------- */
4447
/*** file scope functions ************************************************************************/
45-
4648
/* --------------------------------------------------------------------------------------------- */
4749

4850
/*inline functions */
@@ -55,12 +57,16 @@ mc_fhl_is_file (const file_entry_t * fe)
5557
return S_ISREG (fe->st.st_mode);
5658
}
5759

60+
/* --------------------------------------------------------------------------------------------- */
61+
5862
inline static gboolean
5963
mc_fhl_is_file_exec (const file_entry_t * fe)
6064
{
6165
return is_exe (fe->st.st_mode);
6266
}
6367

68+
/* --------------------------------------------------------------------------------------------- */
69+
6470
inline static gboolean
6571
mc_fhl_is_dir (const file_entry_t * fe)
6672
{
@@ -70,6 +76,8 @@ mc_fhl_is_dir (const file_entry_t * fe)
7076
return S_ISDIR (fe->st.st_mode);
7177
}
7278

79+
/* --------------------------------------------------------------------------------------------- */
80+
7381
inline static gboolean
7482
mc_fhl_is_link (const file_entry_t * fe)
7583
{
@@ -79,24 +87,32 @@ mc_fhl_is_link (const file_entry_t * fe)
7987
return S_ISLNK (fe->st.st_mode);
8088
}
8189

90+
/* --------------------------------------------------------------------------------------------- */
91+
8292
inline static gboolean
8393
mc_fhl_is_hlink (const file_entry_t * fe)
8494
{
8595
return (fe->st.st_nlink > 1);
8696
}
8797

98+
/* --------------------------------------------------------------------------------------------- */
99+
88100
inline static gboolean
89101
mc_fhl_is_link_to_dir (const file_entry_t * fe)
90102
{
91103
return mc_fhl_is_link (fe) && fe->f.link_to_dir;
92104
}
93105

106+
/* --------------------------------------------------------------------------------------------- */
107+
94108
inline static gboolean
95109
mc_fhl_is_stale_link (const file_entry_t * fe)
96110
{
97111
return mc_fhl_is_link (fe) ? fe->f.stale_link : !mc_fhl_is_file (fe);
98112
}
99113

114+
/* --------------------------------------------------------------------------------------------- */
115+
100116
inline static gboolean
101117
mc_fhl_is_device_char (const file_entry_t * fe)
102118
{
@@ -106,6 +122,8 @@ mc_fhl_is_device_char (const file_entry_t * fe)
106122
return S_ISCHR (fe->st.st_mode);
107123
}
108124

125+
/* --------------------------------------------------------------------------------------------- */
126+
109127
inline static gboolean
110128
mc_fhl_is_device_block (const file_entry_t * fe)
111129
{
@@ -115,6 +133,8 @@ mc_fhl_is_device_block (const file_entry_t * fe)
115133
return S_ISBLK (fe->st.st_mode);
116134
}
117135

136+
/* --------------------------------------------------------------------------------------------- */
137+
118138
inline static gboolean
119139
mc_fhl_is_special_socket (const file_entry_t * fe)
120140
{
@@ -124,6 +144,8 @@ mc_fhl_is_special_socket (const file_entry_t * fe)
124144
return S_ISSOCK (fe->st.st_mode);
125145
}
126146

147+
/* --------------------------------------------------------------------------------------------- */
148+
127149
inline static gboolean
128150
mc_fhl_is_special_fifo (const file_entry_t * fe)
129151
{
@@ -133,6 +155,8 @@ mc_fhl_is_special_fifo (const file_entry_t * fe)
133155
return S_ISFIFO (fe->st.st_mode);
134156
}
135157

158+
/* --------------------------------------------------------------------------------------------- */
159+
136160
inline static gboolean
137161
mc_fhl_is_special_door (const file_entry_t * fe)
138162
{
@@ -142,6 +166,8 @@ mc_fhl_is_special_door (const file_entry_t * fe)
142166
return S_ISDOOR (fe->st.st_mode);
143167
}
144168

169+
/* --------------------------------------------------------------------------------------------- */
170+
145171
inline static gboolean
146172
mc_fhl_is_special (const file_entry_t * fe)
147173
{
@@ -246,8 +272,6 @@ mc_fhl_get_color_regexp (const mc_fhl_filter_t * mc_filter, const mc_fhl_t * fhl
246272
return -1;
247273
}
248274

249-
/* --------------------------------------------------------------------------------------------- */
250-
251275
/* --------------------------------------------------------------------------------------------- */
252276
/*** public functions ****************************************************************************/
253277
/* --------------------------------------------------------------------------------------------- */

lib/filehighlight/ini-file-read.c

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343

4444
/*** file scope type declarations ****************************************************************/
4545

46+
/*** forward declarations (file scope functions) *************************************************/
47+
4648
/*** file scope variables ************************************************************************/
4749

4850
/* --------------------------------------------------------------------------------------------- */

lib/keybind.c

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ typedef struct name_keymap_t
5151
long val;
5252
} name_keymap_t;
5353

54+
/*** forward declarations (file scope functions) *************************************************/
55+
5456
/*** file scope variables ************************************************************************/
5557

5658
static name_keymap_t command_names[] = {
@@ -382,6 +384,7 @@ static name_keymap_t command_names[] = {
382384
static const size_t num_command_names = G_N_ELEMENTS (command_names) - 1;
383385
/* *INDENT-ON* */
384386

387+
/* --------------------------------------------------------------------------------------------- */
385388
/*** file scope functions ************************************************************************/
386389
/* --------------------------------------------------------------------------------------------- */
387390

lib/lock.c

+3
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ typedef struct
7575
pid_t pid;
7676
} lock_s;
7777

78+
/*** forward declarations (file scope functions) *************************************************/
79+
7880
/*** file scope variables ************************************************************************/
7981

82+
/* --------------------------------------------------------------------------------------------- */
8083
/*** file scope functions ************************************************************************/
8184
/* --------------------------------------------------------------------------------------------- */
8285
/** \fn static char * lock_build_name (void)

lib/logging.c

+3
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,14 @@
4949

5050
/*** file scope type declarations ****************************************************************/
5151

52+
/*** forward declarations (file scope functions) *************************************************/
53+
5254
/*** file scope variables ************************************************************************/
5355

5456
static gboolean logging_initialized = FALSE;
5557
static gboolean logging_enabled = FALSE;
5658

59+
/* --------------------------------------------------------------------------------------------- */
5760
/*** file scope functions ************************************************************************/
5861
/* --------------------------------------------------------------------------------------------- */
5962

lib/mcconfig/common.c

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
/*** file scope type declarations ****************************************************************/
4141

42+
/*** forward declarations (file scope functions) *************************************************/
43+
4244
/*** file scope variables ************************************************************************/
4345

4446
/* --------------------------------------------------------------------------------------------- */

lib/mcconfig/paths.c

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242

4343
/*** file scope type declarations ****************************************************************/
4444

45+
/*** forward declarations (file scope functions) *************************************************/
46+
4547
/*** file scope variables ************************************************************************/
4648

4749
static gboolean xdg_vars_initialized = FALSE;

lib/mcconfig/set.c

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
/*** file scope type declarations ****************************************************************/
3535

36+
/*** forward declarations (file scope functions) *************************************************/
37+
3638
/*** file scope variables ************************************************************************/
3739

3840
/* --------------------------------------------------------------------------------------------- */

lib/search/glob.c

+4
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@
3939

4040
/*** file scope type declarations ****************************************************************/
4141

42+
/*** forward declarations (file scope functions) *************************************************/
43+
4244
/*** file scope variables ************************************************************************/
4345

46+
/* --------------------------------------------------------------------------------------------- */
4447
/*** file scope functions ************************************************************************/
48+
/* --------------------------------------------------------------------------------------------- */
4549

4650
static GString *
4751
mc_search__glob_translate_to_regex (const GString * astr)

lib/search/hex.c

+6
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ typedef enum
4949

5050
/*** file scope type declarations ****************************************************************/
5151

52+
/*** forward declarations (file scope functions) *************************************************/
53+
5254
/*** file scope variables ************************************************************************/
5355

56+
/* --------------------------------------------------------------------------------------------- */
5457
/*** file scope functions ************************************************************************/
58+
/* --------------------------------------------------------------------------------------------- */
5559

5660
static GString *
5761
mc_search__hex_translate_to_regex (const GString * astr, mc_search_hex_parse_error_t * error_ptr,
@@ -127,7 +131,9 @@ mc_search__hex_translate_to_regex (const GString * astr, mc_search_hex_parse_err
127131
return buff;
128132
}
129133

134+
/* --------------------------------------------------------------------------------------------- */
130135
/*** public functions ****************************************************************************/
136+
/* --------------------------------------------------------------------------------------------- */
131137

132138
void
133139
mc_search__cond_struct_new_init_hex (const char *charset, mc_search_t * lc_mc_search,

lib/search/lib.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,22 @@
4141

4242
/*** global variables ****************************************************************************/
4343

44+
/* *INDENT-OFF* */
4445
const char *STR_E_NOTFOUND = N_("Search string not found");
4546
const char *STR_E_UNKNOWN_TYPE = N_("Not implemented yet");
4647
const char *STR_E_RPL_NOT_EQ_TO_FOUND =
47-
N_("Num of replace tokens not equal to num of found tokens");
48+
N_("Num of replace tokens not equal to num of found tokens");
4849
const char *STR_E_RPL_INVALID_TOKEN = N_("Invalid token number %d");
50+
/* *INDENT-ON* */
4951

5052
/*** file scope macro definitions ****************************************************************/
5153

5254
/*** file scope type declarations ****************************************************************/
5355

5456
typedef gboolean (*case_conv_fn) (const char *ch, char **out, size_t * remain);
5557

58+
/*** forward declarations (file scope functions) *************************************************/
59+
5660
/*** file scope variables ************************************************************************/
5761

5862
/* --------------------------------------------------------------------------------------------- */

lib/search/normal.c

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
/*** file scope type declarations ****************************************************************/
4040

41+
/*** forward declarations (file scope functions) *************************************************/
42+
4143
/*** file scope variables ************************************************************************/
4244

4345
/* --------------------------------------------------------------------------------------------- */

lib/search/regex.c

+3
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,13 @@ typedef enum
5757
REPLACE_T_LOW_TRANSFORM = 8
5858
} replace_transform_type_t;
5959

60+
/*** forward declarations (file scope functions) *************************************************/
6061

6162
/*** file scope variables ************************************************************************/
6263

64+
/* --------------------------------------------------------------------------------------------- */
6365
/*** file scope functions ************************************************************************/
66+
/* --------------------------------------------------------------------------------------------- */
6467

6568
static gboolean
6669
mc_search__regex_str_append_if_special (GString * copy_to, const GString * regex_str,

lib/search/search.c

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747

4848
/*** file scope type declarations ****************************************************************/
4949

50+
/*** forward declarations (file scope functions) *************************************************/
51+
5052
/*** file scope variables ************************************************************************/
5153

5254
static const mc_search_type_str_t mc_search__list_types[] = {
@@ -57,7 +59,9 @@ static const mc_search_type_str_t mc_search__list_types[] = {
5759
{NULL, MC_SEARCH_T_INVALID}
5860
};
5961

62+
/* --------------------------------------------------------------------------------------------- */
6063
/*** file scope functions ************************************************************************/
64+
/* --------------------------------------------------------------------------------------------- */
6165

6266
static mc_search_cond_t *
6367
mc_search__cond_struct_new (mc_search_t * lc_mc_search, const GString * str, const char *charset)

lib/serialize.c

+3
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@
4646

4747
/*** file scope type declarations ****************************************************************/
4848

49+
/*** forward declarations (file scope functions) *************************************************/
50+
4951
/*** file scope variables ************************************************************************/
5052

53+
/* --------------------------------------------------------------------------------------------- */
5154
/*** file scope functions ************************************************************************/
5255
/* --------------------------------------------------------------------------------------------- */
5356

lib/shell.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,19 @@
3737
#include "global.h"
3838
#include "util.h"
3939

40-
4140
/*** global variables ****************************************************************************/
4241

4342
/*** file scope macro definitions ****************************************************************/
4443

4544
/*** file scope type declarations ****************************************************************/
4645

46+
/*** forward declarations (file scope functions) *************************************************/
47+
4748
/*** file scope variables ************************************************************************/
4849

4950
static char rp_shell[PATH_MAX];
5051

52+
/* --------------------------------------------------------------------------------------------- */
5153
/*** file scope functions ************************************************************************/
5254
/* --------------------------------------------------------------------------------------------- */
5355
/**

lib/skin/colors-old.c

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
/*** file scope macro definitions ****************************************************************/
4141

42+
/*** forward declarations (file scope functions) *************************************************/
43+
4244
/*** file scope type declarations ****************************************************************/
4345

4446
typedef struct mc_skin_colors_old_struct
@@ -104,7 +106,9 @@ static const mc_skin_colors_old_t old_colors[] = {
104106

105107
static const size_t num_old_colors = G_N_ELEMENTS (old_colors);
106108

109+
/* --------------------------------------------------------------------------------------------- */
107110
/*** file scope functions ************************************************************************/
111+
/* --------------------------------------------------------------------------------------------- */
108112

109113
static int
110114
old_color_comparator (const void *p1, const void *p2)

0 commit comments

Comments
 (0)