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().
This commit is contained in:
Juan RP 2019-06-18 17:52:19 +02:00
parent 286193515c
commit eddd2cd602

View File

@ -426,7 +426,9 @@ update:
rv = EXIT_FAILURE; rv = EXIT_FAILURE;
goto ret; goto ret;
} }
assert((rcv->env = xbps_dictionary_create())); assert(rcv);
rcv->env = xbps_dictionary_create();
assert(rcv->env);
allocenv = true; allocenv = true;
rcv_get_pkgver(rcv); rcv_get_pkgver(rcv);
@ -442,17 +444,17 @@ update:
d = xbps_dictionary_create(); d = xbps_dictionary_create();
xbps_dictionary_set(rcv->cache, fname, d); xbps_dictionary_set(rcv->cache, fname, d);
} }
assert(xbps_dictionary_set_cstring(d, "pkgname", pkgname)); xbps_dictionary_set_cstring(d, "pkgname", pkgname);
assert(xbps_dictionary_set_cstring(d, "version", version)); xbps_dictionary_set_cstring(d, "version", version);
assert(xbps_dictionary_set_cstring(d, "revision", revision)); xbps_dictionary_set_cstring(d, "revision", revision);
reverts = NULL; reverts = NULL;
xbps_dictionary_get_cstring_nocopy(rcv->env, "reverts", &reverts); xbps_dictionary_get_cstring_nocopy(rcv->env, "reverts", &reverts);
if (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); 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); check(rcv);