From fde72e50fc280e583b8aec13b4d4af3bd1d205e5 Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Mon, 8 Jul 2024 17:27:59 +0200 Subject: removed unneeded headers; fixed some warnings --- src/base64.c | 4 +--- src/bouncesaying.c | 2 +- src/columnt.c | 4 ++-- src/dkimsign.cpp | 2 ++ src/dkimverify.cpp | 6 +++--- src/dnsip.c | 2 -- src/dnstlsa.c | 7 ++----- src/include/dkimbase.h | 4 ---- src/include/dkimsign.h | 2 ++ src/include/dkimverify.h | 2 ++ src/include/global.h | 4 +--- src/include/headerbody.h | 3 ++- src/include/maildir.h | 1 - src/include/sha256.h | 8 ++++---- src/include/spf.h | 2 -- src/maildir.c | 1 - src/newfield.c | 2 -- src/prioq.c | 1 - src/qmail-dksign.c | 3 --- src/qmail-dkverify.c | 4 ---- src/qmail-pw2u.c | 3 +-- src/qmail-qmqpd.c | 1 - src/qmail-smtpam.c | 5 ----- src/qmail-smtpd.c | 4 +--- src/qmail-tcpto.c | 1 - src/sha256.c | 10 +++++----- src/spf.c | 4 +--- src/spfdnsip.c | 3 --- src/srsforward.c | 1 - src/tcpto.c | 1 - src/tls_remote.c | 1 + src/trigger.c | 1 - 32 files changed, 31 insertions(+), 68 deletions(-) (limited to 'src') diff --git a/src/base64.c b/src/base64.c index fca31c9..52725f3 100644 --- a/src/base64.c +++ b/src/base64.c @@ -1,7 +1,5 @@ #include "base64.h" -#include "str.h" - static char *b64alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; #define B64PAD '=' @@ -95,7 +93,7 @@ int b64decode(const unsigned char *in, int l, stralloc *out) int b64encode(stralloc *in, stralloc *out) { unsigned char a, b, c; - int i; + size_t i; char *s; if (in->len == 0) { diff --git a/src/bouncesaying.c b/src/bouncesaying.c index 3d40b69..7a94ab2 100644 --- a/src/bouncesaying.c +++ b/src/bouncesaying.c @@ -2,13 +2,13 @@ #include "exit.h" #include "logmsg.h" -#include "sig.h" #include "wait.h" #define WHO "bouncesaying" int main(int argc, char **argv) { + (void)argc; int pid; int wstat; diff --git a/src/columnt.c b/src/columnt.c index fc76c1a..4262f45 100644 --- a/src/columnt.c +++ b/src/columnt.c @@ -75,8 +75,8 @@ static void printfield(int fieldnum, char *buf, int len) static void split(void (*dofield)(int, char *, int), void (*doline)(void)) { - int i; - int j; + size_t i; + size_t j; int fieldpos; int fieldnum; diff --git a/src/dkimsign.cpp b/src/dkimsign.cpp index 988fd94..124cc29 100644 --- a/src/dkimsign.cpp +++ b/src/dkimsign.cpp @@ -26,6 +26,8 @@ #include +#include + #include "dkim.h" #define OLD_SSL \ diff --git a/src/dkimverify.cpp b/src/dkimverify.cpp index 90f871f..cddca62 100644 --- a/src/dkimverify.cpp +++ b/src/dkimverify.cpp @@ -28,12 +28,12 @@ #include #include +#include + #include "dkim.h" #include "dnsgettxt.h" extern "C" { -#include "stralloc.h" - #include "dns.h" } @@ -127,7 +127,7 @@ int _DKIM_ReportResult(const char *ResFile, const char *result, const char *reas return len; } -const char *DKIM_ErrorResult(const int res) +const char *DKIM_ErrorResult(int res) { const char *errormsg = ""; diff --git a/src/dnsip.c b/src/dnsip.c index d6e3c0d..95bc589 100644 --- a/src/dnsip.c +++ b/src/dnsip.c @@ -3,9 +3,7 @@ #include #include "buffer.h" -#include "dnsresolv.h" #include "exit.h" -#include "fmt.h" #include "ip.h" #include "logmsg.h" #include "stralloc.h" diff --git a/src/dnstlsa.c b/src/dnstlsa.c index 715bde1..0452761 100644 --- a/src/dnstlsa.c +++ b/src/dnstlsa.c @@ -1,12 +1,9 @@ #include #include "buffer.h" -#include "byte.h" -#include "dnsresolv.h" #include "exit.h" #include "getoptb.h" #include "logmsg.h" -#include "str.h" #include "stralloc.h" #include "dns.h" @@ -24,7 +21,7 @@ int main(int argc, char **argv) uint16 selector; uint16 type; char *port = "25"; - char proto[7] = "._tcp."; + const char *proto = "._tcp."; char *host; unsigned char ch; int opt; @@ -38,7 +35,7 @@ int main(int argc, char **argv) switch (opt) { case 'p': port = optarg; break; case 't': break; - case 'u': str_copy(proto, "._udp."); break; + case 'u': proto = "._udp."; break; case 'v': verbose = 1; } } diff --git a/src/include/dkimbase.h b/src/include/dkimbase.h index 320deb9..ce8cf0a 100644 --- a/src/include/dkimbase.h +++ b/src/include/dkimbase.h @@ -25,10 +25,6 @@ #include #include -#include -#include -#include - #define BUFFER_ALLOC_INCREMENT 256 class CDKIMBase { diff --git a/src/include/dkimsign.h b/src/include/dkimsign.h index ad3c9d7..3cc7be8 100644 --- a/src/include/dkimsign.h +++ b/src/include/dkimsign.h @@ -22,6 +22,8 @@ #ifndef DKIMSIGN_H #define DKIMSIGN_H +#include + #include "dkim.h" #include "dkimbase.h" diff --git a/src/include/dkimverify.h b/src/include/dkimverify.h index e1d0a92..f5314b8 100644 --- a/src/include/dkimverify.h +++ b/src/include/dkimverify.h @@ -25,6 +25,8 @@ #include #include +#include + #include "dkim.h" #include "dkimbase.h" diff --git a/src/include/global.h b/src/include/global.h index a35999c..1b1ef16 100644 --- a/src/include/global.h +++ b/src/include/global.h @@ -1,7 +1,5 @@ /* GLOBAL.H - RSAREF types and constants */ -#include - #include "uint_t.h" /* Copyright (C) RSA Laboratories, a division of RSA Data Security, @@ -43,7 +41,7 @@ typedef unsigned long int UINT4; /* PROTO_LIST is defined depending on how PROTOTYPES is defined above. If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it - returns an empty list. + returns an empty list. */ #if PROTOTYPES #define PROTO_LIST(list) list diff --git a/src/include/headerbody.h b/src/include/headerbody.h index eec505f..9420164 100644 --- a/src/include/headerbody.h +++ b/src/include/headerbody.h @@ -4,6 +4,7 @@ #include "buffer.h" #include "stralloc.h" -extern int headerbody(buffer *b, void (*dohf)(stralloc *), void (*hdone)(void), void (*dobl)(stralloc *)); +extern int headerbody( + buffer *b, void (*dohf)(stralloc *), void (*hdone)(void), void (*dobl)(stralloc *)); #endif diff --git a/src/include/maildir.h b/src/include/maildir.h index 9659989..359764d 100644 --- a/src/include/maildir.h +++ b/src/include/maildir.h @@ -1,7 +1,6 @@ #ifndef MAILDIR_H #define MAILDIR_H -#include "logmsg.h" #include "stralloc.h" #include "prioq.h" diff --git a/src/include/sha256.h b/src/include/sha256.h index 80ee0ab..d53600c 100644 --- a/src/include/sha256.h +++ b/src/include/sha256.h @@ -11,10 +11,10 @@ typedef struct { uint32_t state[8]; } sha256_ctx; -static void sha256_init(sha256_ctx *ctx); -static void sha256_transform(sha256_ctx *ctx, uint8_t *data); -static void sha256_update(sha256_ctx *ctx, uint8_t *data, uint32_t len); -static void sha256_final(uint8_t *hash, sha256_ctx *ctx); +extern void sha256_init(sha256_ctx *ctx); +extern void sha256_transform(sha256_ctx *ctx, uint8_t *data); +extern void sha256_update(sha256_ctx *ctx, uint8_t *data, uint32_t len); +extern void sha256_final(uint8_t *hash, sha256_ctx *ctx); extern void sha256_hash(char *hash, const char *data, size_t len); #endif diff --git a/src/include/spf.h b/src/include/spf.h index 0b8b0fc..a7441dd 100644 --- a/src/include/spf.h +++ b/src/include/spf.h @@ -3,8 +3,6 @@ #include "stralloc.h" -#include "ipalloc.h" - /* (Internal) Processing codes */ #define SPF_INIT -1 diff --git a/src/maildir.c b/src/maildir.c index a755177..1576287 100644 --- a/src/maildir.c +++ b/src/maildir.c @@ -7,7 +7,6 @@ #include "direntry.h" #include "env.h" #include "logmsg.h" -#include "str.h" #include "stralloc.h" #include "datetime.h" diff --git a/src/newfield.c b/src/newfield.c index 2e6b07f..a27a2c6 100644 --- a/src/newfield.c +++ b/src/newfield.c @@ -3,10 +3,8 @@ #include #include "fmt.h" -#include "stralloc.h" #include "date822fmt.h" -#include "datetime.h" /* "Date: 26 Sep 1995 04:46:53 -0000\n" */ stralloc newfield_date = {0}; diff --git a/src/prioq.c b/src/prioq.c index 1d3beb2..f796f60 100644 --- a/src/prioq.c +++ b/src/prioq.c @@ -1,6 +1,5 @@ #include "prioq.h" -#include "alloc.h" #include "genalloc.h" GEN_ALLOC_readyplus(prioq, struct prioq_elt, p, len, a, i, n, x, 100, prioq_readyplus); diff --git a/src/qmail-dksign.c b/src/qmail-dksign.c index e94a561..0e5cacd 100644 --- a/src/qmail-dksign.c +++ b/src/qmail-dksign.c @@ -11,8 +11,6 @@ #include "error.h" #include "exit.h" #include "fd.h" -#include "fmt.h" -#include "logmsg.h" #include "open.h" #include "pathexec.h" #include "sig.h" @@ -23,7 +21,6 @@ #include "control.h" #include "fmtqfn.h" -#include "qmail.h" #include "rcpthosts.h" #ifdef USE_CONFIG diff --git a/src/qmail-dkverify.c b/src/qmail-dkverify.c index cb123db..239256c 100644 --- a/src/qmail-dkverify.c +++ b/src/qmail-dkverify.c @@ -5,15 +5,12 @@ #include #include "buffer.h" -#include "byte.h" #include "case.h" #include "env.h" #include "error.h" #include "exit.h" #include "fd.h" -#include "fmt.h" #include "getln.h" -#include "logmsg.h" #include "open.h" #include "pathexec.h" #include "sig.h" @@ -24,7 +21,6 @@ #include "control.h" #include "fmtqfn.h" -#include "qmail.h" #ifdef USE_CONFIG #include "fehsqm-config.h" diff --git a/src/qmail-pw2u.c b/src/qmail-pw2u.c index 948270c..0be600a 100644 --- a/src/qmail-pw2u.c +++ b/src/qmail-pw2u.c @@ -6,10 +6,9 @@ #include "byte.h" #include "constmap.h" #include "exit.h" -#include "fmt.h" +#include "error.h" #include "getln.h" #include "getoptb.h" -#include "logmsg.h" #include "open.h" #include "scan.h" #include "str.h" diff --git a/src/qmail-qmqpd.c b/src/qmail-qmqpd.c index 9a81fb1..08d026e 100644 --- a/src/qmail-qmqpd.c +++ b/src/qmail-qmqpd.c @@ -2,7 +2,6 @@ #include "buffer.h" #include "byte.h" -#include "case.h" #include "env.h" #include "exit.h" #include "fmt.h" diff --git a/src/qmail-smtpam.c b/src/qmail-smtpam.c index 9ef1238..70d5ed4 100644 --- a/src/qmail-smtpam.c +++ b/src/qmail-smtpam.c @@ -5,12 +5,9 @@ #include #include -#include "alloc.h" #include "buffer.h" -#include "byte.h" #include "case.h" #include "constmap.h" -#include "error.h" #include "exit.h" #include "genalloc.h" #include "ip.h" @@ -27,8 +24,6 @@ #include "dns.h" #include "ipalloc.h" #include "ipme.h" -#include "now.h" -#include "quote.h" #include "tcpto.h" #include "tls_errors.h" #include "tls_remote.h" diff --git a/src/qmail-smtpd.c b/src/qmail-smtpd.c index 557649e..09a0920 100644 --- a/src/qmail-smtpd.c +++ b/src/qmail-smtpd.c @@ -1,6 +1,5 @@ #include -#include "alloc.h" #include "base64.h" #include "buffer.h" #include "byte.h" @@ -10,12 +9,11 @@ #include "constmap.h" #include "dnsresolv.h" #include "env.h" +#include "error.h" #include "exit.h" #include "fd.h" #include "fmt.h" -#include "genalloc.h" #include "ip.h" -#include "logmsg.h" #include "open.h" #include "scan.h" #include "sig.h" diff --git a/src/qmail-tcpto.c b/src/qmail-tcpto.c index 26a9b88..681445e 100644 --- a/src/qmail-tcpto.c +++ b/src/qmail-tcpto.c @@ -11,7 +11,6 @@ #include "lock.h" #include "logmsg.h" #include "open.h" -#include "stralloc.h" #include "datetime.h" #include "now.h" diff --git a/src/sha256.c b/src/sha256.c index 0bb29af..00b7319 100644 --- a/src/sha256.c +++ b/src/sha256.c @@ -36,7 +36,7 @@ uint32_t k[64] = { 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2}; -static void sha256_transform(sha256_ctx *ctx, uint8_t *data) +void sha256_transform(sha256_ctx *ctx, uint8_t *data) { uint32_t a, b, c, d, e, f, g, h, i, j, t1, t2, m[64]; @@ -76,7 +76,7 @@ static void sha256_transform(sha256_ctx *ctx, uint8_t *data) ctx->state[7] += h; } -static void sha256_init(sha256_ctx *ctx) +void sha256_init(sha256_ctx *ctx) { ctx->datalen = 0; ctx->bitlen[0] = 0; @@ -91,7 +91,7 @@ static void sha256_init(sha256_ctx *ctx) ctx->state[7] = 0x5be0cd19; } -static void sha256_update(sha256_ctx *ctx, uint8_t *data, uint32_t len) +void sha256_update(sha256_ctx *ctx, uint8_t *data, uint32_t len) { uint32_t i; @@ -106,7 +106,7 @@ static void sha256_update(sha256_ctx *ctx, uint8_t *data, uint32_t len) } } -static void sha256_final(uint8_t *hash, sha256_ctx *ctx) +void sha256_final(uint8_t *hash, sha256_ctx *ctx) { uint32_t i; @@ -152,7 +152,7 @@ static void sha256_final(uint8_t *hash, sha256_ctx *ctx) } } -extern void sha256_hash(char *hash, const char *data, size_t len) +void sha256_hash(char *hash, const char *data, size_t len) { sha256_ctx ctx; sha256_init(&ctx); diff --git a/src/spf.c b/src/spf.c index 18d86a3..ec7426c 100644 --- a/src/spf.c +++ b/src/spf.c @@ -1,16 +1,14 @@ #include "spf.h" -#include "alloc.h" #include "byte.h" #include "case.h" +#include "dnsresolv.h" #include "fmt.h" #include "ip.h" #include "scan.h" #include "str.h" #include "stralloc.h" -#include "dns.h" -#include "ipalloc.h" #include "ipme.h" #include "now.h" diff --git a/src/spfdnsip.c b/src/spfdnsip.c index 4e05b31..741de25 100644 --- a/src/spfdnsip.c +++ b/src/spfdnsip.c @@ -1,9 +1,7 @@ #include -#include "alloc.h" #include "byte.h" #include "case.h" -#include "fmt.h" #include "ip.h" #include "scan.h" #include "str.h" @@ -11,7 +9,6 @@ #include "dns.h" #include "ipalloc.h" -#include "ipme.h" #include "now.h" #include "spf.h" diff --git a/src/srsforward.c b/src/srsforward.c index 967a015..96cd2d9 100644 --- a/src/srsforward.c +++ b/src/srsforward.c @@ -4,7 +4,6 @@ #include "buffer.h" #include "constmap.h" #include "env.h" -#include "exit.h" #include "fmt.h" #include "logmsg.h" #include "sig.h" diff --git a/src/tcpto.c b/src/tcpto.c index 2e2805e..7fb9b41 100644 --- a/src/tcpto.c +++ b/src/tcpto.c @@ -10,7 +10,6 @@ #include "seek.h" #include "datetime.h" -#include "ipalloc.h" #include "now.h" char tcpto_buf[1024]; diff --git a/src/tls_remote.c b/src/tls_remote.c index 3ae1a94..60e4b4d 100644 --- a/src/tls_remote.c +++ b/src/tls_remote.c @@ -8,6 +8,7 @@ #include "fmt.h" #include "str.h" #include "stralloc.h" +#include "uint_t.h" #include "dns.h" #include "tls_errors.h" diff --git a/src/trigger.c b/src/trigger.c index 0578430..4a68ecd 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -5,7 +5,6 @@ #include "close.h" #include "ndelay.h" #include "open.h" -#include "select.h" static int fd = -1; -- cgit v1.2.3