formatting

This commit is contained in:
anon
2024-12-05 13:06:37 +01:00
parent 0df5b014a3
commit 8f97bb51e5
3 changed files with 24 additions and 22 deletions

View File

@ -121,8 +121,8 @@ static const char dispchars[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJK
int dispchar2int(const char c) { int dispchar2int(const char c) {
int i = 0; int i = 0;
while(dispchars[i] != c){ while (dispchars[i] != c) {
if(dispchars[i] == '\00'){ return -1; } if (dispchars[i] == '\00') { return -1; }
++i; ++i;
} }
return i; return i;
@ -259,8 +259,8 @@ void exitcurses(void) {
fflush(stdout); fflush(stdout);
} }
void force_window(void){ void force_window(void) {
switch(input_mode){ switch (input_mode) {
case INPUT_CHANGE: case INPUT_CHANGE:
current_window = &wresult; current_window = &wresult;
break; 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 // XXX: this could be optimized by only overriding the buffer if theres an actual
// change // change
werase(whelp); werase(whelp);
@ -287,14 +288,16 @@ static inline void display_help(void) {
do_press_any_key = true; do_press_any_key = true;
} }
static inline void display_case(void){ static inline
void display_case(void) {
wmove(wcase, 0, 0); wmove(wcase, 0, 0);
wattron(wcase, COLOR_PAIR(COLOR_PAIR_CASE)); wattron(wcase, COLOR_PAIR(COLOR_PAIR_CASE));
waddstr(wcase, (caseless ? "Case: OFF" : "Case: ON")); waddstr(wcase, (caseless ? "Case: OFF" : "Case: ON"));
wattroff(wcase, COLOR_PAIR(COLOR_PAIR_CASE)); 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)); wattron(stdscr, COLOR_PAIR(COLOR_PAIR_FRAME));
box(stdscr, 0, 0); box(stdscr, 0, 0);
@ -326,7 +329,8 @@ static inline void display_frame(const bool border_only) {
wattroff(stdscr, COLOR_PAIR(COLOR_PAIR_FRAME)); wattroff(stdscr, COLOR_PAIR(COLOR_PAIR_FRAME));
} }
static inline void display_mode(void) { static inline
void display_mode(void) {
werase(wmode); werase(wmode);
for(int i = 0; i < FIELDS; ++i) { 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); werase(winput);
wattron(winput, COLOR_PAIR(COLOR_PAIR_PROMPT)); wattron(winput, COLOR_PAIR(COLOR_PAIR_PROMPT));
mvwaddstr(winput, 0, 0, prompts[input_mode]); mvwaddstr(winput, 0, 0, prompts[input_mode]);
@ -354,7 +359,8 @@ static inline void display_command_field(void) {
display_cursor(); display_cursor();
} }
static inline void display_results(void) { static inline
void display_results(void) {
int i; int i;
char *s; char *s;
int screenline; /* screen line number */ int screenline; /* screen line number */
@ -403,12 +409,12 @@ static inline void display_results(void) {
/* --- Display the column headings --- */ /* --- Display the column headings --- */
wattron(wresult, COLOR_PAIR(COLOR_PAIR_TABLE_HEADER)); wattron(wresult, COLOR_PAIR(COLOR_PAIR_TABLE_HEADER));
wmove(wresult, 2, 2); 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"); 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)); wattroff(wresult, COLOR_PAIR(COLOR_PAIR_TABLE_HEADER));
/* --- Display table entries --- */ /* --- Display table entries --- */
@ -600,7 +606,8 @@ endrefs:
wattroff(wresult, COLOR_PAIR(COLOR_PAIR_PAGER_MSG)); wattroff(wresult, COLOR_PAIR(COLOR_PAIR_PAGER_MSG));
} }
static inline void display_cursor(void) { static inline
void display_cursor(void) {
chtype i; chtype i;
int yoffset = 0, xoffset = 0; int yoffset = 0, xoffset = 0;
@ -614,7 +621,7 @@ static inline void display_cursor(void) {
} }
void horswp_window(void) { void horswp_window(void) {
if(input_mode != INPUT_NORMAL){ return; } if (input_mode != INPUT_NORMAL) { return; }
if(current_window != &wresult) { if(current_window != &wresult) {
if(totallines == 0) { return; } if(totallines == 0) { return; }

View File

@ -740,7 +740,6 @@ int findinit(const char *pattern_) {
/* if this is a regular expression or letter case is to be ignored */ /* if this is a regular expression or letter case is to be ignored */
/* or there is an inverted index */ /* or there is an inverted index */
if(isregexp == true || caseless == true || invertedindex == true) { if(isregexp == true || caseless == true || invertedindex == true) {
/* remove a leading ^ */ /* remove a leading ^ */
s = pattern; s = pattern;
if(*s == '^') { if(*s == '^') {
@ -790,7 +789,6 @@ void findcleanup(void) {
} }
/* match the pattern to the string */ /* match the pattern to the string */
static static
bool match(void) { bool match(void) {
char string[PATLEN + 1]; char string[PATLEN + 1];
@ -810,7 +808,6 @@ bool match(void) {
} }
/* match the rest of the pattern to the name */ /* match the rest of the pattern to the name */
static static
bool matchrest(void) { bool matchrest(void) {
int i = 1; int i = 1;
@ -828,7 +825,6 @@ bool matchrest(void) {
} }
/* put the reference into the file */ /* put the reference into the file */
static static
void putref(int seemore, const char *file, const char *func) { void putref(int seemore, const char *file, const char *func) {
FILE *output; FILE *output;
@ -843,7 +839,6 @@ void putref(int seemore, const char *file, const char *func) {
} }
/* put the source line into the file */ /* put the source line into the file */
static static
void putsource(int seemore, FILE *output) { void putsource(int seemore, FILE *output) {
char *tmpblockp; char *tmpblockp;
@ -897,7 +892,6 @@ void putsource(int seemore, FILE *output) {
} }
/* put the rest of the cross-reference line into the file */ /* put the rest of the cross-reference line into the file */
static static
void putline(FILE *output) { void putline(FILE *output) {
char *cp; char *cp;

View File

@ -244,7 +244,8 @@ noredisp:
return 1; return 1;
} }
static int global_input(const int c) { static
int global_input(const int c) {
switch(c) { switch(c) {
case '\t': case '\t':
horswp_window(); horswp_window();