From eddd2cd6023568c663c6b0b1eb9d71c0ec643bb0 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 18 Jun 2019 17:52:19 +0200 Subject: [PATCH] xbps-checkvers: stop abusing assert(). assert() must not change program behaviour. It's unlikely that xbps_dictionary_set_cstring() fails, but even so proplib will report it, so no need to run it via assert(). --- bin/xbps-checkvers/main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/xbps-checkvers/main.c b/bin/xbps-checkvers/main.c index 50d471d0..d9a3480d 100644 --- a/bin/xbps-checkvers/main.c +++ b/bin/xbps-checkvers/main.c @@ -426,7 +426,9 @@ update: rv = EXIT_FAILURE; goto ret; } - assert((rcv->env = xbps_dictionary_create())); + assert(rcv); + rcv->env = xbps_dictionary_create(); + assert(rcv->env); allocenv = true; rcv_get_pkgver(rcv); @@ -442,17 +444,17 @@ update: d = xbps_dictionary_create(); xbps_dictionary_set(rcv->cache, fname, d); } - assert(xbps_dictionary_set_cstring(d, "pkgname", pkgname)); - assert(xbps_dictionary_set_cstring(d, "version", version)); - assert(xbps_dictionary_set_cstring(d, "revision", revision)); + xbps_dictionary_set_cstring(d, "pkgname", pkgname); + xbps_dictionary_set_cstring(d, "version", version); + xbps_dictionary_set_cstring(d, "revision", revision); reverts = NULL; xbps_dictionary_get_cstring_nocopy(rcv->env, "reverts", &reverts); if (reverts) - assert(xbps_dictionary_set_cstring(d, "reverts", reverts)); + xbps_dictionary_set_cstring(d, "reverts", reverts); mtime = xbps_data_create_data(&st.st_mtim, sizeof st.st_mtim); - assert(xbps_dictionary_set(d, "mtime", mtime)); + xbps_dictionary_set(d, "mtime", mtime); } check(rcv);