commit 6258daeb86bb3ab929666d176f9fdb95dd6fd822 from: Martijn van Duren date: Thu Nov 14 12:46:43 2019 UTC Annotate unused variables and remove unnecessary *n_len assignment commit - 4574fbd094b0b258d32078f6feb25547df97a8de commit + 6258daeb86bb3ab929666d176f9fdb95dd6fd822 blob - 2eaa14e61a0d7ee3891732a2843c21671c18fbf9 blob + abd74f4d4aa1f11bfea7981ea702ecd3fab1dad6 --- opensmtpd.c +++ opensmtpd.c @@ -995,7 +995,7 @@ osmtpd_errx(int eval, const char *fmt, ...) } static void -osmtpd_newline(struct io *io, int ev, void *arg) +osmtpd_newline(struct io *io, int ev, __unused void *arg) { static char *linedup = NULL; static size_t dupsize = 0; @@ -1172,7 +1172,7 @@ osmtpd_newline(struct io *io, int ev, void *arg) } static void -osmtpd_outevt(struct io *io, int evt, void *arg) +osmtpd_outevt(__unused struct io *io, int evt, __unused void *arg) { switch (evt) { case IO_LOWAT: @@ -1185,8 +1185,8 @@ osmtpd_outevt(struct io *io, int evt, void *arg) } static void -osmtpd_noargs(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx, char *params, - char *linedup) +osmtpd_noargs(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx, + __unused char *params, __unused char *linedup) { void (*f)(struct osmtpd_ctx *); @@ -1196,7 +1196,7 @@ osmtpd_noargs(struct osmtpd_callback *cb, struct osmtp static void osmtpd_onearg(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx, char *line, - char *linedup) + __unused char *linedup) { void (*f)(struct osmtpd_ctx *, const char *); @@ -1227,7 +1227,7 @@ osmtpd_connect(struct osmtpd_callback *cb, struct osmt static void osmtpd_identify(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx, - char *identity, char *linedup) + char *identity, __unused char *linedup) { void (*f)(struct osmtpd_ctx *, const char *); @@ -1291,7 +1291,7 @@ osmtpd_link_connect(struct osmtpd_callback *cb, struct static void osmtpd_link_disconnect(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx, - char *param, char *linedup) + __unused char *param, __unused char *linedup) { void (*f)(struct osmtpd_ctx *); size_t i; @@ -1320,7 +1320,7 @@ osmtpd_link_disconnect(struct osmtpd_callback *cb, str static void osmtpd_link_greeting(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx, - char *identity, char *linedup) + char *identity, __unused char *linedup) { void (*f)(struct osmtpd_ctx *, const char *); @@ -1336,7 +1336,7 @@ osmtpd_link_greeting(struct osmtpd_callback *cb, struc static void osmtpd_link_identify(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx, - char *identity, char *linedup) + char *identity, __unused char *linedup) { void (*f)(struct osmtpd_ctx *, const char *); @@ -1352,7 +1352,7 @@ osmtpd_link_identify(struct osmtpd_callback *cb, struc static void osmtpd_link_tls(struct osmtpd_callback *cb, struct osmtpd_ctx *ctx, - char *ciphers, char *linedup) + char *ciphers, __unused char *linedup) { void (*f)(struct osmtpd_ctx *, const char *); @@ -1945,7 +1945,6 @@ osmtpd_addrtoss(char *addr, struct sockaddr_storage *s if (addr[0] == '[') { sin6 = (struct sockaddr_in6 *)ss; - sin6->sin6_len = sizeof(*sin6); sin6->sin6_family = AF_INET6; sin6->sin6_port = 0; if (hasport) { @@ -1989,7 +1988,6 @@ osmtpd_addrtoss(char *addr, struct sockaddr_storage *s } } else if (strncasecmp(addr, "unix:", 5) == 0) { sun = (struct sockaddr_un *)ss; - sun->sun_len = sizeof(*sun); sun->sun_family = AF_UNIX; if (strlcpy(sun->sun_path, addr, sizeof(sun->sun_path)) >= sizeof(sun->sun_path)) { @@ -1998,7 +1996,6 @@ osmtpd_addrtoss(char *addr, struct sockaddr_storage *s } } else { sin = (struct sockaddr_in *)ss; - sin->sin_len = sizeof(*sin); sin->sin_family = AF_INET; sin->sin_port = 0; if (hasport) { blob - 9a58a8d8764b383d3e902c5ee51f806f44b3552b blob + 26546428978f8cb26810f3fb5620e67180f3ba0f --- opensmtpd.h +++ opensmtpd.h @@ -15,6 +15,13 @@ */ #include +#ifndef __dead +#define __dead __attribute__((__noreturn__)) +#endif +#ifndef __unused +#define __unused __attribute__((unused)) +#endif + enum osmtpd_status { OSMTPD_STATUS_OK, OSMTPD_STATUS_TEMPFAIL,