diff options
Diffstat (limited to 'src/cli_val.h')
-rw-r--r-- | src/cli_val.h | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/src/cli_val.h b/src/cli_val.h index c9d59a6..5abaaee 100644 --- a/src/cli_val.h +++ b/src/cli_val.h @@ -156,8 +156,6 @@ extern void push_path(vtw_path *path, char *segm); extern void push_path_no_escape(vtw_path *path, char *segm); extern void free_def(vtw_def *defp); extern void free_sorted(vtw_sorted *sortp); -extern void *my_malloc(size_t size, const char *name); -extern void *my_realloc(void *ptr, size_t size, const char *name); extern vtw_path m_path, t_path; @@ -167,29 +165,33 @@ extern vtw_path m_path, t_path; extern void add_val(valstruct *first, valstruct *second); extern int cli_val_read(char *buf, int max_size); extern vtw_node *make_val_node(valstruct *val); -extern char *my_strdup(const char *s, const char *name); extern valstruct str2val(char *cp); extern void dump_tree(vtw_node *node, int lev); extern void dump_def(vtw_def *defp); -extern boolean val_cmp(valstruct *left, valstruct *right, vtw_cond_e cond); -extern void out_of_memory(void); +extern boolean val_cmp(const valstruct *left, const valstruct *right, + vtw_cond_e cond); +extern void out_of_memory(void) __attribute__((noreturn)); extern void subtract_values(char **lhs, const char *rhs); extern boolean validate_value(vtw_def *def, char *value); -extern void internal_error(int line, char *file); +extern void internal_error(int line, const char *file) + __attribute__((noreturn)); extern void done(void); extern void del_value(vtw_def *defp, char *cp); -extern void bye(char *msg, ...); -extern void print_msg(char *msg, ...); +extern void bye(const char *msg, ...) + __attribute__((format(printf, 1, 2), noreturn)); +extern void print_msg(const char *msg, ...) + __attribute__((format(printf, 1, 2))); extern void switch_path(first_seg *seg); extern void vtw_sort(valstruct *valp, vtw_sorted *sortp); extern void free_val(valstruct *val); -extern void my_free(void *ptr); extern void touch(void); -extern void dump_log(int argc, char **argv); -extern char *type_to_name(vtw_type_e type); +extern int mkdir_p(const char *path); + +extern const char *type_to_name(vtw_type_e type); extern boolean execute_list(vtw_node *cur, vtw_def *def); extern void touch_dir(const char *dp); +extern void touch_file(const char *name); extern void copy_path(vtw_path *to, vtw_path *from); extern void free_path(vtw_path *path); @@ -197,7 +199,7 @@ extern void free_path(vtw_path *path); void mark_paths(vtw_mark *markp); void restore_paths(vtw_mark *markp); -extern int get_config_lock(); +extern int get_config_lock(void); #define VTWERR_BADPATH -2 #define VTWERR_OK 0 @@ -217,14 +219,21 @@ extern int out_fd; extern FILE *out_stream; extern FILE *err_stream; -extern int initialize_output(); +extern int initialize_output(void); + +/* debug hooks? */ +#define my_malloc(size, name) malloc(size) +#define my_realloc(ptr, size, name) realloc(ptr, size) +#define my_strdup(str, name) strdup(str) +#define my_free(ptr) free(ptr) /*** debug ***/ #undef CLI_DEBUG #ifdef CLI_DEBUG -#define DPRINT(...) printf(__VA_ARGS__) +#define DPRINT(fmt, arg...) printf(fmt, #arg) +extern void dump_log(int argc, char **argv); #else -#define DPRINT(...) +#define DPRINT(fmt, arg...) while (0) { printf(fmt, ##arg); } +#define dump_log(argc, argv) #endif - #endif |