From 44a6b1b68029833893f6e9cee35aa27a974038f6 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Thu, 2 May 2013 22:51:50 -0400 Subject: Add __attribute__((const, pure, format)) in various places I'm assuming that it's fine if a _const_ or _pure_ function calls assert. It is assumed that the assert won't trigger, and even if it does, it can only trigger on the first call with a given set of parameters, and we don't care if the compiler moves the order of calls. --- src/shared/socket-util.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/shared/socket-util.h') diff --git a/src/shared/socket-util.h b/src/shared/socket-util.h index 33838345ed..7829a337fc 100644 --- a/src/shared/socket-util.h +++ b/src/shared/socket-util.h @@ -67,9 +67,9 @@ typedef enum SocketAddressBindIPv6Only { int socket_address_parse(SocketAddress *a, const char *s); int socket_address_parse_netlink(SocketAddress *a, const char *s); int socket_address_print(const SocketAddress *a, char **p); -int socket_address_verify(const SocketAddress *a); +int socket_address_verify(const SocketAddress *a) _pure_; -bool socket_address_can_accept(const SocketAddress *a); +bool socket_address_can_accept(const SocketAddress *a) _pure_; int socket_address_listen( const SocketAddress *a, @@ -90,12 +90,12 @@ bool socket_address_matches_fd(const SocketAddress *a, int fd); int make_socket_fd(const char* address, int flags); -bool socket_address_equal(const SocketAddress *a, const SocketAddress *b); +bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) _pure_; bool socket_address_needs_mount(const SocketAddress *a, const char *prefix); -const char* socket_address_bind_ipv6_only_to_string(SocketAddressBindIPv6Only b); -SocketAddressBindIPv6Only socket_address_bind_ipv6_only_from_string(const char *s); +const char* socket_address_bind_ipv6_only_to_string(SocketAddressBindIPv6Only b) _const_; +SocketAddressBindIPv6Only socket_address_bind_ipv6_only_from_string(const char *s) _pure_; int netlink_family_to_string_alloc(int b, char **s); int netlink_family_from_string(const char *s); -- cgit v1.2.3-54-g00ecf