Skip to content

Commit

Permalink
Make some variables static
Browse files Browse the repository at this point in the history
as suggested by clang -Wmissing-variable-declarations
  • Loading branch information
dilyanpalauzov authored and elliefm committed Oct 4, 2024
1 parent a651631 commit 119bc61
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 34 deletions.
2 changes: 1 addition & 1 deletion imap/calalarmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extern char *optarg;

static int debugmode = 0;

struct namespace calalarmd_namespace;
static struct namespace calalarmd_namespace;

EXPORTED void fatal(const char *msg, int err)
{
Expand Down
6 changes: 3 additions & 3 deletions imap/ctl_conversationsdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ enum { UNKNOWN, DUMP, UNDUMP, ZERO, BUILD, RECALC, AUDIT, CHECKFOLDERS };

static int verbose = 0;

int mode = UNKNOWN;
static int mode = UNKNOWN;
static const char *audit_temp_directory;

int recalc_silent = 1;
hashu64_table *zerocids = NULL;
static int recalc_silent = 1;
static hashu64_table *zerocids = NULL;

static int do_dump(const char *fname, const char *userid)
{
Expand Down
2 changes: 1 addition & 1 deletion imap/cyr_dbtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
#define STACKSIZE 64000
static char stack[STACKSIZE+1];

int outfd;
static int outfd;

static struct db *db = NULL;

Expand Down
14 changes: 8 additions & 6 deletions imap/cyr_virusscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ struct scan_rock {
};

/* globals for callback functions */
int disinfect = 0;
int email_notification = 0;
struct infected_mbox *public = NULL;
struct infected_mbox *user = NULL;
static int disinfect = 0;
static int email_notification = 0;
#if 0
static struct infected_mbox *public = NULL;
#endif
static struct infected_mbox *user = NULL;

static int verbose = 0;

Expand Down Expand Up @@ -234,15 +236,15 @@ void clamav_destroy(void *state)
free(st);
}

struct scan_engine engine =
static struct scan_engine engine =
{ "ClamAV", NULL, &clamav_init, &clamav_scanfile, &clamav_destroy };

#elif defined(HAVE_SOME_UNKNOWN_VIRUS_SCANNER)
/* XXX Add other implementations here */

#else
/* NO configured virus scanner */
struct scan_engine engine = { "<None Configured>", NULL, NULL, NULL, NULL };
static struct scan_engine engine = { "<None Configured>", NULL, NULL, NULL, NULL };
#endif


Expand Down
2 changes: 1 addition & 1 deletion imap/dav_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@

static int sievedb_upgrade(sqldb_t *db);

struct sqldb_upgrade davdb_upgrade[] = {
static const struct sqldb_upgrade davdb_upgrade[] = {
{ 2, CMD_DBUPGRADEv2, NULL },
{ 3, CMD_DBUPGRADEv3, NULL },
{ 4, CMD_DBUPGRADEv4, NULL },
Expand Down
2 changes: 1 addition & 1 deletion imap/http_admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static void admin_init(struct buf *serverinfo __attribute__((unused)))
compile_time = calc_compile_time(__TIME__, __DATE__);
}

const struct action_t {
static const struct action_t {
const char *name;
const char *desc;
int (*func)(struct transaction_t *txn);
Expand Down
2 changes: 1 addition & 1 deletion imap/imapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static int referral_kick = 0; /* kick after next command received, for

/* global conversations database holder to avoid re-opening during
* status command or list responses */
struct conversations_state *global_conversations = NULL;
static struct conversations_state *global_conversations = NULL;

/* all subscription commands go to the backend server containing the
user's inbox */
Expand Down
2 changes: 1 addition & 1 deletion imap/lmtpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static struct protstream *deliver_out, *deliver_in;
int deliver_logfd = -1; /* used in lmtpengine.c */

/* our cached connections */
ptrarray_t backend_cached = PTRARRAY_INITIALIZER;
static ptrarray_t backend_cached = PTRARRAY_INITIALIZER;

static struct protocol_t lmtp_protocol =
{ "lmtp", "lmtp", TYPE_STD,
Expand Down
2 changes: 1 addition & 1 deletion imap/message_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
static int usage(const char *name);

static int verbose = 0;
enum { PART_TREE, TEXT_SECTIONS, TEXT_RECEIVER } dump_mode = PART_TREE;
static enum { PART_TREE, TEXT_SECTIONS, TEXT_RECEIVER } dump_mode = PART_TREE;

/*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/

Expand Down
4 changes: 2 additions & 2 deletions imap/nntpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ extern int opterr;
currently piping */

/* the current server most commands go to */
struct backend *backend_current = NULL;
static struct backend *backend_current = NULL;

/* our cached connections */
ptrarray_t backend_cached = PTRARRAY_INITIALIZER;
static ptrarray_t backend_cached = PTRARRAY_INITIALIZER;

#ifdef HAVE_SSL
static SSL *tls_conn;
Expand Down
2 changes: 1 addition & 1 deletion imap/pop3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const int config_need_data = CONFIG_NEED_PARTITION_DATA;
static struct namespace popd_namespace;

/* PROXY stuff */
struct backend *backend = NULL;
static struct backend *backend = NULL;

static struct protocol_t pop3_protocol =
{ "pop3", "pop", TYPE_STD,
Expand Down
2 changes: 1 addition & 1 deletion imap/quota_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

#define QDB config_quota_db

HIDDEN struct db *qdb;
static struct db *qdb;

/* skanky reuse of mboxname locks. Ideally we would rename
* them to something more general and use them elsewhere */
Expand Down
2 changes: 1 addition & 1 deletion imap/smmapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
/* generated headers are not necessarily in current directory */
#include "imap/imap_err.h"

const char *BB;
static const char *BB;
static int forcedowncase;

extern int optind, opterr;
Expand Down
2 changes: 1 addition & 1 deletion imap/sync_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

static int opt_force = 0; // FIXME

struct sync_client_state rightnow_sync_cs;
static struct sync_client_state rightnow_sync_cs;

/* protocol definitions */
static char *imap_sasl_parsesuccess(char *str, const char **status);
Expand Down
2 changes: 1 addition & 1 deletion imap/zoneinfo_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

#define DB config_zoneinfo_db

struct db *zoneinfodb;
static struct db *zoneinfodb;
static int zoneinfo_dbopen = 0;
static struct buf databuf = BUF_INITIALIZER;

Expand Down
4 changes: 2 additions & 2 deletions lib/charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ EXPORTED void charset_lib_done(void)
#define unicode_isvalid(c) \
(!((c >= 0xd800 && c <= 0xdfff) || ((unsigned)c > 0x10ffff)))

char QPSAFECHAR[256] = {
static const char QPSAFECHAR[256] = {
/* control chars are unsafe */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -2555,7 +2555,7 @@ static charset_t lookup_buf(const char *buf, size_t len)
/* of course = and _ are not included in the set, because they themselves
need to be quoted it’s just saying they can be present in the Q wordi
itself, because they’re part of the quoting system */
char QPMIMEPHRASESAFECHAR[256] = {
static const char QPMIMEPHRASESAFECHAR[256] = {
/* control chars are unsafe */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand Down
4 changes: 2 additions & 2 deletions ptclient/ptexpire.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
#include "xmalloc.h"

/* global */
time_t timenow;
time_t expire_time = (3*60*60); /* 3 Hours */
static time_t timenow;
static time_t expire_time = (3*60*60); /* 3 Hours */

static int expire_p(void *rockp __attribute__((unused)),
const char *key __attribute__((unused)),
Expand Down
2 changes: 1 addition & 1 deletion ptclient/ptloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ char *ptsmodule_unix_canonifyid(const char *identifier, size_t len)
const int config_need_data = 0;

static char ptclient_debug = 0;
struct db *ptsdb = NULL;
static struct db *ptsdb = NULL;

int service_init(int argc, char *argv[], char **envp __attribute__((unused)))
{
Expand Down
8 changes: 4 additions & 4 deletions timsieved/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ extern int sieved_userisadmin;
extern sasl_conn_t *sieved_saslconn; /* the sasl connection context */
static const char *referral_host = NULL;

int authenticated = 0;
int verify_only = 0;
int starttls_done = 0;
sasl_ssf_t sasl_ssf = 0;
static int authenticated = 0;
static int verify_only = 0;
static int starttls_done = 0;
static sasl_ssf_t sasl_ssf = 0;
#ifdef HAVE_SSL
/* our tls connection, if any */
static SSL *tls_conn = NULL;
Expand Down
4 changes: 2 additions & 2 deletions timsieved/timsieved.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ sasl_conn_t *sieved_saslconn; /* the sasl connection context */
static struct auth_state *sieved_authstate = 0;

int sieved_timeout;
struct protstream *sieved_out;
struct protstream *sieved_in;
static struct protstream *sieved_out;
static struct protstream *sieved_in;

int sieved_logfd = -1;

Expand Down

0 comments on commit 119bc61

Please sign in to comment.