From: Richard Kettlewell Date: Sun, 13 Sep 2015 11:06:31 +0000 (+0100) Subject: Add nonnull attribute to a few function args. X-Git-Tag: 5.2~76 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/38e8ac481cb0862b21eba5f70bdf38c9453ec7bc?ds=sidebyside Add nonnull attribute to a few function args. --- 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 */