Skip to content

Commit

Permalink
tidy headers/prototypes
Browse files Browse the repository at this point in the history
* add/remove `#include`s
* add/remove `struct` prototypes
* add function prototypes
* remove duplicate function prototypes
* make functions static

These changes have been suggested iwyu and the compiler options:
* -Wredundant-decls
* -Wstrict-prototypes
* -Wmissing-prototypes

Co-authored-by: Pietro Cerutti <[email protected]>
  • Loading branch information
flatcap and gahr committed Feb 25, 2020
1 parent 10f3959 commit a9c0669
Show file tree
Hide file tree
Showing 97 changed files with 126 additions and 127 deletions.
2 changes: 1 addition & 1 deletion addrbook.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static int alias_sort_address(const void *a, const void *b)
/**
* mutt_dlg_alias_observer - Listen for config changes affecting the Alias menu - Implements ::observer_t()
*/
int mutt_dlg_alias_observer(struct NotifyCallback *nc)
static int mutt_dlg_alias_observer(struct NotifyCallback *nc)
{
if (!nc->event_data || !nc->global_data)
return -1;
Expand Down
4 changes: 3 additions & 1 deletion autocrypt/autocrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include "config.h"
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include "autocrypt_private.h"
Expand All @@ -36,12 +38,12 @@
#include "config/lib.h"
#include "email/lib.h"
#include "gui/lib.h"
#include "lib.h"
#include "globals.h"
#include "muttlib.h"
#include "mx.h"
#include "options.h"
#include "send.h"
#include "autocrypt/lib.h"
#include "ncrypt/lib.h"

/**
Expand Down
2 changes: 1 addition & 1 deletion autocrypt/autocrypt_acct_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
#include "config/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "lib.h"
#include "format_flags.h"
#include "globals.h"
#include "keymap.h"
#include "mutt_menu.h"
#include "muttlib.h"
#include "opcodes.h"
#include "autocrypt/lib.h"

/**
* struct AccountEntry - An entry in the Autocrypt account Menu
Expand Down
2 changes: 1 addition & 1 deletion autocrypt/autocrypt_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#include "autocrypt_private.h"
#include "mutt/lib.h"
#include "address/lib.h"
#include "lib.h"
#include "globals.h"
#include "autocrypt/lib.h"

/* Prepared statements */
static sqlite3_stmt *AccountGetStmt;
Expand Down
2 changes: 1 addition & 1 deletion browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ void mutt_browser_select_dir(const char *f)
/**
* mutt_dlg_browser_observer - Listen for config changes affecting the Browser menu - Implements ::observer_t()
*/
int mutt_dlg_browser_observer(struct NotifyCallback *nc)
static int mutt_dlg_browser_observer(struct NotifyCallback *nc)
{
if (!nc->event_data || !nc->global_data)
return -1;
Expand Down
9 changes: 9 additions & 0 deletions command_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,26 @@

#include "config.h"
#include <errno.h>
#include <libintl.h>
#include <limits.h>
#include <regex.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "command_parse.h"
#include "alias.h"
#include "context.h"
#include "globals.h"
#include "init.h"
#include "keymap.h"
#include "monitor.h"
#include "mutt_commands.h"
#include "mutt_logging.h"
Expand Down
1 change: 1 addition & 0 deletions command_parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#ifndef MUTT_COMMAND_PARSE_H
#define MUTT_COMMAND_PARSE_H

#include "config.h"
#include "mutt_commands.h"

struct Buffer;
Expand Down
1 change: 1 addition & 0 deletions commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "hdrline.h"
#include "hook.h"
#include "icommands.h"
#include "init.h"
#include "keymap.h"
#include "mutt_commands.h"
#include "mutt_logging.h"
Expand Down
4 changes: 2 additions & 2 deletions compose.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
#include "globals.h"
#include "hook.h"
#include "index.h"
#include "init.h"
#include "keymap.h"
#include "main.h"
#include "mutt_attach.h"
#include "mutt_header.h"
#include "mutt_logging.h"
Expand Down Expand Up @@ -1085,7 +1085,7 @@ static void compose_status_line(char *buf, size_t buflen, size_t col, int cols,
/**
* mutt_dlg_compose_observer - Listen for config changes affecting the Compose menu - Implements ::observer_t()
*/
int mutt_dlg_compose_observer(struct NotifyCallback *nc)
static int mutt_dlg_compose_observer(struct NotifyCallback *nc)
{
if (!nc->event_data || !nc->global_data)
return -1;
Expand Down
2 changes: 1 addition & 1 deletion config/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "mutt/lib.h"
#include "dump.h"
#include "set.h"
#include "subset.h"
#include "types.h"

void mutt_pretty_mailbox(char *buf, size_t buflen);
Expand Down
1 change: 1 addition & 0 deletions config/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "config.h"
#include <stddef.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include "mutt/lib.h"
#include "path.h"
Expand Down
1 change: 0 additions & 1 deletion config/set.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "config.h"
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include "mutt/lib.h"
#include "set.h"
#include "inheritance.h"
Expand Down
1 change: 0 additions & 1 deletion config/set.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "subset.h"

struct Buffer;
struct ConfigSet;
Expand Down
4 changes: 3 additions & 1 deletion config/subset.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "mutt/lib.h"
#include "subset.h"
#include "dump.h"
#include "set.h"

struct Notify;

/**
* elem_list_sort - Sort two HashElem pointers to config
* @param a First HashElem
Expand Down
2 changes: 2 additions & 0 deletions config/subset.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
#include <stdint.h>

struct Buffer;
struct ConfigSet;
struct HashElem;
struct Notify;

/**
* enum ConfigScope - Who does this Config belong to?
Expand Down
3 changes: 3 additions & 0 deletions conn/connaccount.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@

#include "config.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "mutt/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "connaccount.h"
#include "globals.h"
#include "options.h"
Expand Down
2 changes: 1 addition & 1 deletion conn/connaccount.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef MUTT_CONN_ACCOUNT_H
#define MUTT_CONN_ACCOUNT_H

#include "mutt_account.h"
#include <stdint.h>

/**
* enum ConnAccountField - Login credentials
Expand Down
2 changes: 1 addition & 1 deletion conn/sasl.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
#include <time.h>
#include "mutt/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "sasl.h"
#include "connaccount.h"
#include "connection.h"
#include "mutt_account.h"
#include "options.h"

/* arbitrary. SASL will probably use a smaller buffer anyway. OTOH it's
Expand Down
4 changes: 2 additions & 2 deletions conn/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <stddef.h>
#include <time.h>

struct Connection;

/**
* enum ConnectionType - Type of connection
*/
Expand All @@ -37,8 +39,6 @@ enum ConnectionType
MUTT_CONNECTION_SSL, ///< SSL/TLS-encrypted connection
};

struct Connection;

struct Connection *mutt_socket_new(enum ConnectionType type);

int mutt_socket_open(struct Connection *conn);
Expand Down
1 change: 0 additions & 1 deletion conn/ssl_gnutls.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "connection.h"
#include "globals.h"
#include "keymap.h"
#include "mutt_account.h"
#include "mutt_menu.h"
#include "muttlib.h"
#include "opcodes.h"
Expand Down
1 change: 0 additions & 1 deletion conn/tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <time.h>
#include <unistd.h>
#include "mutt/lib.h"
#include "mutt.h"
#include "tunnel.h"
#include "conn_globals.h"
#include "connaccount.h"
Expand Down
1 change: 0 additions & 1 deletion context.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "config.h"
#include <string.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "context.h"
Expand Down
1 change: 1 addition & 0 deletions context.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

struct Email;
struct EmailList;
struct Mailbox;
struct NotifyCallback;

/**
Expand Down
2 changes: 1 addition & 1 deletion core/account.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <stddef.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "core/neomutt.h"
#include "account.h"
#include "mailbox.h"

Expand Down
1 change: 1 addition & 0 deletions core/mailbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <time.h>
#include "mutt/lib.h"

struct ConfigSubset;
struct Email;

#define MB_NORMAL 0
Expand Down
2 changes: 0 additions & 2 deletions debug/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
#define MUTT_DEBUG_LIB_H

#include "config.h"
#include "mutt/lib.h"
#include "core/lib.h"

#ifdef HAVE_LIBUNWIND
void show_backtrace(void);
Expand Down
4 changes: 3 additions & 1 deletion debug/parse_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
*/

#include "config.h"
#include <stdio.h>
#include "mutt/lib.h"
#include "mutt.h"
#include "lib.h"
#include "init.h"
#include "mutt_commands.h"

/**
Expand Down
1 change: 1 addition & 0 deletions email/url.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ struct Url

enum UrlScheme url_check_scheme(const char *s);
void url_free (struct Url **ptr);
struct Url * url_new (void);
struct Url *url_parse (const char *src);
int url_pct_decode (char *s);
void url_pct_encode (char *buf, size_t buflen, const char *src);
Expand Down
1 change: 1 addition & 0 deletions enter.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "context.h"
#include "enter_state.h"
#include "globals.h"
#include "init.h"
#include "keymap.h"
#include "mutt_history.h"
#include "mutt_mailbox.h"
Expand Down
1 change: 1 addition & 0 deletions gui/color.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "color.h"
#include "context.h"
#include "globals.h"
#include "init.h"
#include "mutt_commands.h"
#include "mutt_curses.h"
#include "options.h"
Expand Down
2 changes: 1 addition & 1 deletion gui/curs_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ int mutt_any_key_to_continue(const char *s)
/**
* mutt_dlg_dopager_observer - Listen for config changes affecting the dopager menus - Implements ::observer_t()
*/
int mutt_dlg_dopager_observer(struct NotifyCallback *nc)
static int mutt_dlg_dopager_observer(struct NotifyCallback *nc)
{
if (!nc->event_data || !nc->global_data)
return -1;
Expand Down
3 changes: 1 addition & 2 deletions gui/mutt_curses.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#define MUTT_MUTT_CURSES_H

#include "config.h"
#include <stdbool.h>
#include "color.h"

#ifdef USE_SLANG_CURSES
Expand Down Expand Up @@ -53,7 +52,7 @@
#else /* USE_SLANG_CURSES */

#ifdef HAVE_NCURSESW_NCURSES_H
#include <ncursesw/ncurses.h>
#include <ncursesw/ncurses.h> // IWYU pragma: keep
#elif defined(HAVE_NCURSES_NCURSES_H)
#include <ncurses/ncurses.h>
#elif defined(HAVE_NCURSES_H)
Expand Down
4 changes: 1 addition & 3 deletions gui/mutt_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@
#include "config/lib.h"
#include "core/lib.h"
#include "mutt_window.h"
#include "context.h"
#include "globals.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "options.h"
#include "pager.h"
#include "reflow.h"

struct MuttWindow *RootWindow = NULL; ///< Parent of all Windows
Expand Down Expand Up @@ -157,7 +155,7 @@ void mutt_window_clrtoeol(struct MuttWindow *win)
/**
* mutt_dlg_rootwin_observer - Listen for config changes affecting the Root Window - Implements ::observer_t()
*/
int mutt_dlg_rootwin_observer(struct NotifyCallback *nc)
static int mutt_dlg_rootwin_observer(struct NotifyCallback *nc)
{
if (!nc->event_data || !nc->global_data)
return -1;
Expand Down
3 changes: 2 additions & 1 deletion gui/mutt_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#define MUTT_MUTT_WINDOW_H

#include "config.h"
#include <stdbool.h>
#include "mutt/lib.h"

/**
* enum MuttWindowOrientation - Which way does the Window expand?
Expand Down Expand Up @@ -138,7 +140,6 @@ void mutt_winlist_free (struct MuttWindowList *head);
struct MuttWindow *mutt_window_find(struct MuttWindow *root, enum WindowType type);
struct MuttWindow *mutt_window_dialog(struct MuttWindow *win);

void mutt_winlist_free (struct MuttWindowList *head);
void dialog_pop(void);
void dialog_push(struct MuttWindow *dlg);

Expand Down
Loading

0 comments on commit a9c0669

Please sign in to comment.