From 8f97bb51e56f3dcc3aa90907b174afbf5db1ceb5 Mon Sep 17 00:00:00 2001 From: anon Date: Thu, 5 Dec 2024 13:06:37 +0100 Subject: [PATCH] formatting --- source/display.c | 37 ++++++++++++++++++++++--------------- source/find.c | 6 ------ source/input.c | 3 ++- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/source/display.c b/source/display.c index 070c8d3..2fc0f60 100644 --- a/source/display.c +++ b/source/display.c @@ -121,8 +121,8 @@ static const char dispchars[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJK int dispchar2int(const char c) { int i = 0; - while(dispchars[i] != c){ - if(dispchars[i] == '\00'){ return -1; } + while (dispchars[i] != c) { + if (dispchars[i] == '\00') { return -1; } ++i; } return i; @@ -259,8 +259,8 @@ void exitcurses(void) { fflush(stdout); } -void force_window(void){ - switch(input_mode){ +void force_window(void) { + switch (input_mode) { case INPUT_CHANGE: current_window = &wresult; break; @@ -272,7 +272,8 @@ void force_window(void){ } } -static inline void display_help(void) { +static inline +void display_help(void) { // XXX: this could be optimized by only overriding the buffer if theres an actual // change werase(whelp); @@ -287,14 +288,16 @@ static inline void display_help(void) { do_press_any_key = true; } -static inline void display_case(void){ +static inline +void display_case(void) { wmove(wcase, 0, 0); wattron(wcase, COLOR_PAIR(COLOR_PAIR_CASE)); waddstr(wcase, (caseless ? "Case: OFF" : "Case: ON")); wattroff(wcase, COLOR_PAIR(COLOR_PAIR_CASE)); } -static inline void display_frame(const bool border_only) { +static inline +void display_frame(const bool border_only) { wattron(stdscr, COLOR_PAIR(COLOR_PAIR_FRAME)); box(stdscr, 0, 0); @@ -326,7 +329,8 @@ static inline void display_frame(const bool border_only) { wattroff(stdscr, COLOR_PAIR(COLOR_PAIR_FRAME)); } -static inline void display_mode(void) { +static inline +void display_mode(void) { werase(wmode); for(int i = 0; i < FIELDS; ++i) { @@ -344,7 +348,8 @@ static inline void display_mode(void) { } } -static inline void display_command_field(void) { +static inline +void display_command_field(void) { werase(winput); wattron(winput, COLOR_PAIR(COLOR_PAIR_PROMPT)); mvwaddstr(winput, 0, 0, prompts[input_mode]); @@ -354,7 +359,8 @@ static inline void display_command_field(void) { display_cursor(); } -static inline void display_results(void) { +static inline +void display_results(void) { int i; char *s; int screenline; /* screen line number */ @@ -403,12 +409,12 @@ static inline void display_results(void) { /* --- Display the column headings --- */ wattron(wresult, COLOR_PAIR(COLOR_PAIR_TABLE_HEADER)); wmove(wresult, 2, 2); - if(dispcomponents > 0) wprintw(wresult, "%-*s ", filelen, "File"); + if (dispcomponents > 0) { wprintw(wresult, "%-*s ", filelen, "File"); } - if(field == SYMBOL || field == CALLEDBY || field == CALLING) { + if (field == SYMBOL || field == CALLEDBY || field == CALLING) { wprintw(wresult, "%-*s ", fcnlen, "Function"); } - if(field != FILENAME) { waddstr(wresult, "Line"); } + if (field != FILENAME) { waddstr(wresult, "Line"); } wattroff(wresult, COLOR_PAIR(COLOR_PAIR_TABLE_HEADER)); /* --- Display table entries --- */ @@ -600,7 +606,8 @@ endrefs: wattroff(wresult, COLOR_PAIR(COLOR_PAIR_PAGER_MSG)); } -static inline void display_cursor(void) { +static inline +void display_cursor(void) { chtype i; int yoffset = 0, xoffset = 0; @@ -614,7 +621,7 @@ static inline void display_cursor(void) { } void horswp_window(void) { - if(input_mode != INPUT_NORMAL){ return; } + if (input_mode != INPUT_NORMAL) { return; } if(current_window != &wresult) { if(totallines == 0) { return; } diff --git a/source/find.c b/source/find.c index 0122300..641d821 100644 --- a/source/find.c +++ b/source/find.c @@ -740,7 +740,6 @@ int findinit(const char *pattern_) { /* if this is a regular expression or letter case is to be ignored */ /* or there is an inverted index */ if(isregexp == true || caseless == true || invertedindex == true) { - /* remove a leading ^ */ s = pattern; if(*s == '^') { @@ -790,7 +789,6 @@ void findcleanup(void) { } /* match the pattern to the string */ - static bool match(void) { char string[PATLEN + 1]; @@ -810,7 +808,6 @@ bool match(void) { } /* match the rest of the pattern to the name */ - static bool matchrest(void) { int i = 1; @@ -828,7 +825,6 @@ bool matchrest(void) { } /* put the reference into the file */ - static void putref(int seemore, const char *file, const char *func) { FILE *output; @@ -843,7 +839,6 @@ void putref(int seemore, const char *file, const char *func) { } /* put the source line into the file */ - static void putsource(int seemore, FILE *output) { char *tmpblockp; @@ -897,7 +892,6 @@ void putsource(int seemore, FILE *output) { } /* put the rest of the cross-reference line into the file */ - static void putline(FILE *output) { char *cp; diff --git a/source/input.c b/source/input.c index 7f144e4..11c8f44 100644 --- a/source/input.c +++ b/source/input.c @@ -244,7 +244,8 @@ noredisp: return 1; } -static int global_input(const int c) { +static +int global_input(const int c) { switch(c) { case '\t': horswp_window();