check arguments, return error instead of raising exceptions. (#1125)

* check arguments, return error instaed of raising exceptions. close #1117.

* remove empty lines. remove thr underscore prefix in function name.
This commit is contained in:
Chen Huitao
2019-08-23 17:05:14 +08:00
committed by Nguyen Anh Quynh
parent bc572be472
commit 23a426625f
4 changed files with 119 additions and 3 deletions

7
uc.c
View File

@@ -371,12 +371,13 @@ uc_err uc_reg_read_batch(uc_engine *uc, int *ids, void **vals, int count)
UNICORN_EXPORT
uc_err uc_reg_write_batch(uc_engine *uc, int *ids, void *const *vals, int count)
{
int ret = UC_ERR_OK;
if (uc->reg_write)
uc->reg_write(uc, (unsigned int *)ids, vals, count);
ret = uc->reg_write(uc, (unsigned int *)ids, vals, count);
else
return -1; // FIXME: need a proper uc_err
return UC_ERR_EXCEPTION; // FIXME: need a proper uc_err
return UC_ERR_OK;
return ret;
}