mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-06 22:04:12 +01:00
util: add explicit types for calback functions definitions
It makes the code easier to read to explicitly define a type for the functions that are used for callbacks, so this patch does this for the wmmenugen tool. It was an opportunity to highlight some variable definitions that looked like function prototypes, and were as such misplaced in the code, being a source of confusion. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
b75ac967d9
commit
765814e393
@@ -37,11 +37,16 @@ static int dirParseFunc(const char *filename, const struct stat *st, int tflags,
|
||||
static int menuSortFunc(const void *left, const void *right);
|
||||
static int nodeFindSubMenuByNameFunc(const void *item, const void *cdata);
|
||||
static WMTreeNode *findPositionInMenu(const char *submenu);
|
||||
static void (*parse)(const char *file, void (*addWMMenuEntryCallback)(WMMenuEntry *aEntry));
|
||||
static Bool (*validateFilename)(const char *filename, const struct stat *st, int tflags, struct FTW *ftw);
|
||||
|
||||
|
||||
typedef void fct_parse_menufile(const char *file, cb_add_menu_entry *addWMMenuEntryCallback);
|
||||
typedef Bool fct_validate_filename(const char *filename, const struct stat *st, int tflags, struct FTW *ftw);
|
||||
|
||||
|
||||
static WMArray *plMenuNodes;
|
||||
static const char *terminal;
|
||||
static fct_parse_menufile *parse;
|
||||
static fct_validate_filename *validateFilename;
|
||||
|
||||
extern char *__progname;
|
||||
|
||||
|
||||
@@ -50,6 +50,9 @@ extern WMTreeNode *menu;
|
||||
|
||||
extern char *env_lang, *env_ctry, *env_enc, *env_mod;
|
||||
|
||||
/* Type for the call-back function to add a menu entry to the current menu */
|
||||
typedef void cb_add_menu_entry(WMMenuEntry *entry);
|
||||
|
||||
/* wmmenu_misc.c
|
||||
*/
|
||||
void parse_locale(const char *what, char **env_lang, char **env_ctry, char **env_enc, char **env_mod);
|
||||
@@ -58,8 +61,8 @@ Bool fileInPath(const char *file);
|
||||
|
||||
/* implemented parsers
|
||||
*/
|
||||
void parse_xdg(const char *file, void (*addWMMenuEntryCallback)(WMMenuEntry *aEntry));
|
||||
void parse_wmconfig(const char *file, void (*addWMMenuEntryCallback)(WMMenuEntry *aEntry));
|
||||
void parse_xdg(const char *file, cb_add_menu_entry *addWMMenuEntryCallback);
|
||||
void parse_wmconfig(const char *file, cb_add_menu_entry *addWMMenuEntryCallback);
|
||||
Bool wmconfig_validate_file(const char *filename, const struct stat *st, int tflags, struct FTW *ftw);
|
||||
|
||||
#endif /* WMMENUGEN_H */
|
||||
|
||||
@@ -47,7 +47,8 @@ static Bool wmc_to_wm(WMConfigMenuEntry **wmc, WMMenuEntry **wm);
|
||||
static void parse_wmconfig_line(char **label, char **key, char **value, const char *line);
|
||||
static void init_wmconfig_storage(WMConfigMenuEntry **wmc);
|
||||
|
||||
void parse_wmconfig(const char *file, void (*addWMMenuEntryCallback)(WMMenuEntry *aEntry))
|
||||
|
||||
void parse_wmconfig(const char *file, cb_add_menu_entry *addWMMenuEntryCallback)
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[1024];
|
||||
|
||||
@@ -79,7 +79,8 @@ static Bool xdg_to_wm(XDGMenuEntry **xdg, WMMenuEntry **wmentry);
|
||||
static void init_xdg_storage(XDGMenuEntry **xdg);
|
||||
static void init_wm_storage(WMMenuEntry **wm);
|
||||
|
||||
void parse_xdg(const char *file, void (*addWMMenuEntryCallback)(WMMenuEntry *aEntry))
|
||||
|
||||
void parse_xdg(const char *file, cb_add_menu_entry *addWMMenuEntryCallback)
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[1024];
|
||||
|
||||
Reference in New Issue
Block a user