mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-05-28 04:03:29 -04:00
replace assert() calls with ASSERT()
OpenVPN's ASSERT() macro will do a bit more than the standard-libc
assert() call, namely print out which function and what expression
failed, before calling _exit(1). Also, it can not be accidentially
compiled-away (-DNDEBUG).
Use of ASSERT() is generally only advised in cases of "this must not
happen, but if it does, it's a programming or state corruption error
that we must know about". Use of assert() is lacking the extra debug
info, and as such, not advised at all.
Change-Id: I6480d6f741c2368a0d951004b91167d5943f8f9d
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: mandree <matthias.andree@gmx.de>
Message-Id: <20250907211252.23924-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32824.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 88f8edbf75)
This commit is contained in:
parent
3c9fe88120
commit
2c57936e8f
2 changed files with 5 additions and 5 deletions
|
|
@ -100,7 +100,7 @@ nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *ss)
|
|||
|
||||
in->sin_len = sizeof(*in);
|
||||
data = nvlist_get_binary(nvl, "address", &len);
|
||||
assert(len == sizeof(in->sin_addr));
|
||||
ASSERT(len == sizeof(in->sin_addr));
|
||||
memcpy(&in->sin_addr, data, sizeof(in->sin_addr));
|
||||
in->sin_port = nvlist_get_number(nvl, "port");
|
||||
break;
|
||||
|
|
@ -114,7 +114,7 @@ nvlist_to_sockaddr(const nvlist_t *nvl, struct sockaddr_storage *ss)
|
|||
|
||||
in6->sin6_len = sizeof(*in6);
|
||||
data = nvlist_get_binary(nvl, "address", &len);
|
||||
assert(len == sizeof(in6->sin6_addr));
|
||||
ASSERT(len == sizeof(in6->sin6_addr));
|
||||
memcpy(&in6->sin6_addr, data, sizeof(in6->sin6_addr));
|
||||
in6->sin6_port = nvlist_get_number(nvl, "port");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ management_callback_send_cc_message(void *arg,
|
|||
static unsigned int
|
||||
management_callback_remote_entry_count(void *arg)
|
||||
{
|
||||
assert(arg);
|
||||
ASSERT(arg);
|
||||
struct context *c = (struct context *) arg;
|
||||
struct connection_list *l = c->options.connection_list;
|
||||
|
||||
|
|
@ -340,8 +340,8 @@ management_callback_remote_entry_count(void *arg)
|
|||
static bool
|
||||
management_callback_remote_entry_get(void *arg, unsigned int index, char **remote)
|
||||
{
|
||||
assert(arg);
|
||||
assert(remote);
|
||||
ASSERT(arg);
|
||||
ASSERT(remote);
|
||||
|
||||
struct context *c = (struct context *) arg;
|
||||
struct connection_list *l = c->options.connection_list;
|
||||
|
|
|
|||
Loading…
Reference in a new issue