Remove some exit() calls from librz/ (#954)

This commit is contained in:
Anton Kochkov 2021-04-02 15:55:32 +08:00 committed by GitHub
parent eddd2d1b3d
commit cefd03899f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 12 deletions

View file

@ -1,4 +1,5 @@
#include "crypto_serpent_algo.h"
#include <rz_util/rz_assert.h>
static const ut8 S[][16] = {
{ 3, 8, 15, 1, 10, 6, 5, 11, 14, 13, 4, 2, 7, 0, 9, 12 }, /* S0: */
@ -64,10 +65,7 @@ static inline ut8 apply_sbox_inv(int si, ut8 x) {
}
static inline ut8 get_bit(int i, ut32 input) {
if (i >= 32) {
eprintf("Wrong bit asked");
exit(1);
}
rz_return_val_if_fail(i < 32, 0);
return (input >> i) & 1;
}
@ -91,10 +89,7 @@ void apply_FP(ut32 in[DW_BY_BLOCK], ut32 out[DW_BY_BLOCK]) {
void serpent_keyschedule(struct serpent_state st,
ut32 subkeys[NB_SUBKEYS * DW_BY_BLOCK]) {
if ((st.key_size != 128) && (st.key_size != 192) && (st.key_size != 256)) {
eprintf("Invalid key size");
exit(1);
}
rz_return_if_fail((st.key_size == 128) || (st.key_size == 192) || (st.key_size == 256));
ut32 tmpkeys[DW_BY_BLOCK * NB_SUBKEYS + DW_BY_USERKEY] = { 0 };
const ut32 phi = 0x9e3779b9;

View file

@ -1049,7 +1049,8 @@ static void rcc_next(RzEgg *egg) {
if (!strcmp(str, "while")) {
char var[128];
if (egg->lang.lastctxdelta >= 0) {
exit(eprintf("ERROR: Unsupported while syntax\n"));
eprintf("ERROR: Unsupported while syntax\n");
return;
}
sprintf(var, "__begin_%d_%d_%d\n", egg->lang.nfunctions, CTX, egg->lang.nestedi[CTX - 1]);
e->while_end(egg, var); // get_frame_label (1));
@ -1292,9 +1293,10 @@ RZ_API int rz_egg_lang_parsechar(RzEgg *egg, char c) {
}
if (egg->lang.slurp) {
if (egg->lang.slurp != '"' && c == egg->lang.slurpin) { // only happend when (...(...)...)
exit(eprintf(
eprintf(
"%s:%d Nesting of expressions not yet supported\n",
egg->lang.file, egg->lang.line));
egg->lang.file, egg->lang.line);
return -1;
}
if (c == egg->lang.slurp && egg->lang.oc != '\\') { // close egg->lang.slurp
egg->lang.elem[egg->lang.elem_n] = '\0';

View file

@ -191,7 +191,7 @@ int main(int argc, char **argv) {
if (err != NULL) {
mpc_err_print(err);
mpc_err_delete(err);
exit(1);
return -1;
}
#if 1