From 38e8ac481cb0862b21eba5f70bdf38c9453ec7bc Mon Sep 17 00:00:00 2001 Message-Id: <38e8ac481cb0862b21eba5f70bdf38c9453ec7bc.1714363224.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 13 Sep 2015 12:06:31 +0100 Subject: [PATCH] Add nonnull attribute to a few function args. Organization: Straylight/Edgeware From: Richard Kettlewell --- lib/addr.h | 17 +++++++++-------- lib/eventlog.h | 9 +++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/addr.h b/lib/addr.h index 6b3991f..385259d 100644 --- a/lib/addr.h +++ b/lib/addr.h @@ -45,25 +45,26 @@ struct netaddress { struct addrinfo *get_address(const struct stringlist *a, const struct addrinfo *pref, - char **namep); + char **namep) + attribute((nonnull (1))); int addrinfocmp(const struct addrinfo *a, - const struct addrinfo *b); + const struct addrinfo *b) attribute((nonnull (1, 2))); int sockaddrcmp(const struct sockaddr *a, - const struct sockaddr *b); + const struct sockaddr *b) attribute((nonnull (1, 2))); -int multicast(const struct sockaddr *sa); -char *format_sockaddr(const struct sockaddr *sa); +int multicast(const struct sockaddr *sa) attribute((nonnull (1))); +char *format_sockaddr(const struct sockaddr *sa) attribute((nonnull (1))); int netaddress_parse(struct netaddress *na, int nvec, - char **vec); + char **vec) attribute((nonnull (1))); void netaddress_format(const struct netaddress *na, int *nvecp, - char ***vecp); + char ***vecp) attribute((nonnull (1))); struct addrinfo *netaddress_resolve(const struct netaddress *na, int passive, - int protocol); + int protocol) attribute((nonnull (1))); #endif /* ADDR_H */ diff --git a/lib/eventlog.h b/lib/eventlog.h index e29fcfc..64154d1 100644 --- a/lib/eventlog.h +++ b/lib/eventlog.h @@ -41,25 +41,26 @@ struct eventlog_output { /** @brief Add an event log output * @param lo Pointer to output to add */ -void eventlog_add(struct eventlog_output *lo); +void eventlog_add(struct eventlog_output *lo) attribute((nonnull(1))); /** @brief Remove an event log output * @param lo Pointer to output to remove */ -void eventlog_remove(struct eventlog_output *lo); +void eventlog_remove(struct eventlog_output *lo) attribute((nonnull(1))); /** @brief Send a message to the event log * @param keyword Distinguishing keyword for event * @param ... Extra data, terminated by (char *)0 */ -void eventlog(const char *keyword, ...); +void eventlog(const char *keyword, ...) attribute((nonnull(1))); /** @brief Send a message to the event log * @param keyword Distinguishing keyword for event * @param raw Unformatted data * @param ... Extra data, terminated by (char *)0 */ -void eventlog_raw(const char *keyword, const char *raw, ...); +void eventlog_raw(const char *keyword, const char *raw, ...) + attribute((nonnull(1, 2))); #endif /* EVENTLOG_H */ -- [mdw]