Ensuring that functions declarations indicate that they have no parameters which resolves #252

This commit is contained in:
Martin Dvorak 2018-08-12 11:11:40 +02:00
parent b51d5f2e25
commit d201ef1f84
6 changed files with 45 additions and 37 deletions

View file

@ -223,7 +223,15 @@ static const char *INSTALL_ZSH_STRING=
"\n# add this configuration to ~/.zshrc"
"\nexport HISTFILE=~/.zsh_history # ensure history file visibility"
"\nexport HH_CONFIG=hicolor # get more colors"
#if defined(__MS_WSL__)
// TODO binding to be rewritten for zsh@WSL as it's done for Bash - hstr_winwsl() like function to be implemented to make it work on WSL
"\nbindkey -s \"\\C-r\" \"\\eqhh\\n\" # bind hh to Ctrl-r (for Vi mode check doc)"
#elif defined(__CYGWIN__)
// TODO binding to be rewritten for zsh@Cygwin as it's done for Bash - hstr_winwsl() like function to be implemented to make it work on WSL
"\nbindkey -s \"\\C-r\" \"\\eqhh\\n\" # bind hh to Ctrl-r (for Vi mode check doc)"
#else
"\nbindkey -s \"\\C-r\" \"\\eqhh\\n\" # bind hh to Ctrl-r (for Vi mode check doc)"
#endif
// TODO try variant with args/pars separation
//"\nbindkey -s \"\\C-r\" \"\\eqhh --\\n\" # bind hh to Ctrl-r (for Vi mode check doc)"
// alternate binding options in zsh:
@ -312,7 +320,7 @@ typedef struct {
static Hstr* hstr;
void hstr_init()
void hstr_init(void)
{
hstr->selection=NULL;
hstr->selectionRegexpMatch=NULL;
@ -335,7 +343,7 @@ void hstr_init()
hstr_regexp_init(&hstr->regexp);
}
unsigned recalculate_max_history_items()
unsigned recalculate_max_history_items(void)
{
hstr->promptItems = getmaxy(stdscr) - 3;
if(hstr->promptBottom) {
@ -429,7 +437,7 @@ void hstr_get_env_configuration(Hstr *hstr)
}
}
unsigned print_prompt()
unsigned print_prompt(void)
{
unsigned xoffset = 0, promptLength;
@ -475,7 +483,7 @@ void add_to_selection(Hstr *hstr, char *line, unsigned int *index)
*index = *index + 1;
}
void print_help_label()
void print_help_label(void)
{
int cursorX=getcurx(stdscr);
int cursorY=getcury(stdscr);
@ -558,7 +566,7 @@ void print_cmd_added_favorite_label(const char *cmd, Hstr *hstr)
refresh();
}
void print_history_label()
void print_history_label(void)
{
unsigned width=getmaxx(stdscr);

View file

@ -21,7 +21,7 @@
static bool terminalHasColors=FALSE;
void hstr_curses_start()
void hstr_curses_start(void)
{
initscr();
keypad(stdscr, TRUE);
@ -42,7 +42,7 @@ void hstr_curses_start()
#endif
}
bool terminal_has_colors() {
bool terminal_has_colors(void) {
return terminalHasColors;
}

View file

@ -182,7 +182,7 @@ char *get_shell_name_by_ppid(const int pid)
return name;
}
bool isZshParentShell() {
bool isZshParentShell(void) {
pid_t parentPid=getppid();
char* cmdline=get_shell_name_by_ppid(parentPid);
bool result=cmdline && strstr(cmdline, "zsh");

View file

@ -31,8 +31,8 @@
#define color_attr_off(C) if(terminal_has_colors()) { attroff(C); }
#define color_init_pair(X, Y, Z) if(terminal_has_colors()) { init_pair(X, Y, Z); }
void hstr_curses_start();
bool terminal_has_colors();
void hstr_curses_start(void);
bool terminal_has_colors(void);
void hstr_curses_stop(bool keepPage);
#endif

View file

@ -42,6 +42,6 @@ void fill_terminal_input(char* cmd, bool padding);
void reverse_char_pointer_array(char **array, unsigned length);
void get_hostname(int bufferSize, char *buffer);
void toggle_case(char *str, bool lowercase);
bool isZshParentShell();
bool isZshParentShell(void);
#endif