diff options
author | Ronny Chevalier <chevalier.ronny@gmail.com> | 2015-01-22 22:53:42 +0100 |
---|---|---|
committer | Ronny Chevalier <chevalier.ronny@gmail.com> | 2015-01-22 23:10:56 +0100 |
commit | 0c0cdb06c139b52ff103287f6909b3daa5b2dc54 (patch) | |
tree | f904cb032c43691d325b6bb19941a2c115a07416 /src/libsystemd/sd-resolve/test-resolve.c | |
parent | 714af6af8a912650f9129f8b056ed92589443060 (diff) |
tests: use assert_se instead of assert
Otherwise they can be optimized away with -DNDEBUG
Diffstat (limited to 'src/libsystemd/sd-resolve/test-resolve.c')
-rw-r--r-- | src/libsystemd/sd-resolve/test-resolve.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libsystemd/sd-resolve/test-resolve.c b/src/libsystemd/sd-resolve/test-resolve.c index a9dc9313a6..d08e1b5a05 100644 --- a/src/libsystemd/sd-resolve/test-resolve.c +++ b/src/libsystemd/sd-resolve/test-resolve.c @@ -28,7 +28,6 @@ #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> -#include <assert.h> #include <signal.h> #include <errno.h> @@ -40,7 +39,7 @@ static int getaddrinfo_handler(sd_resolve_query *q, int ret, const struct addrinfo *ai, void *userdata) { const struct addrinfo *i; - assert(q); + assert_se(q); if (ret != 0) { log_error("getaddrinfo error: %s %i", gai_strerror(ret), ret); @@ -60,7 +59,7 @@ static int getaddrinfo_handler(sd_resolve_query *q, int ret, const struct addrin } static int getnameinfo_handler(sd_resolve_query *q, int ret, const char *host, const char *serv, void *userdata) { - assert(q); + assert_se(q); if (ret != 0) { log_error("getnameinfo error: %s %i", gai_strerror(ret), ret); @@ -77,7 +76,7 @@ static int res_handler(sd_resolve_query *q, int ret, unsigned char *answer, void unsigned char *end = answer + ret; HEADER *head = (HEADER *) answer; char name[256]; - assert(q); + assert_se(q); if (ret < 0) { log_error("res_query() error: %s %i", strerror(errno), errno); @@ -96,7 +95,7 @@ static int res_handler(sd_resolve_query *q, int ret, unsigned char *answer, void /* Ignore the questions */ while (qdcount-- > 0 && (len = dn_expand(answer, end, pos, name, 255)) >= 0) { - assert(len >= 0); + assert_se(len >= 0); pos += len + QFIXEDSZ; } @@ -104,7 +103,7 @@ static int res_handler(sd_resolve_query *q, int ret, unsigned char *answer, void while (ancount-- > 0 && (len = dn_expand(answer, end, pos, name, 255)) >= 0) { /* Ignore the initial string */ uint16_t pref, weight, port; - assert(len >= 0); + assert_se(len >= 0); pos += len; /* Ignore type, ttl, class and dlen */ pos += 10; |