improve iter_make() and fix is_rtti_obj() cause address sanitize false error report
This commit is contained in:
parent
a17ddb9fb7
commit
00080a95f3
4 changed files with 16 additions and 5 deletions
|
|
@ -82,6 +82,11 @@ void destroy(var v)
|
|||
return;
|
||||
}
|
||||
|
||||
/* disable address sanitize as it's a possible case that calculated address of
|
||||
* obj may not be valid */
|
||||
#if defined(__GNUC__)
|
||||
__attribute__((no_sanitize("address")))
|
||||
#endif
|
||||
int is_rtti_obj(var v)
|
||||
{
|
||||
meta_obj_t* obj = NULL;
|
||||
|
|
|
|||
10
src/iter.c
10
src/iter.c
|
|
@ -4,10 +4,12 @@
|
|||
|
||||
#include "rtti.h"
|
||||
|
||||
int iter_make(iterator_t* it, var v)
|
||||
int iter_make(iterator_t* it, var v, ...)
|
||||
{
|
||||
meta_obj_t* obj = NULL;
|
||||
iter_make_fn_t method = NULL;
|
||||
va_list ap;
|
||||
int rc = 0;
|
||||
|
||||
if (it == NULL) {
|
||||
return -EINVAL;
|
||||
|
|
@ -23,10 +25,14 @@ int iter_make(iterator_t* it, var v)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
va_start(ap, v);
|
||||
memset(it, 0x0, sizeof(*it));
|
||||
it->obj = obj;
|
||||
|
||||
return method(it);
|
||||
rc = method(it, ap);
|
||||
va_end(ap);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int iter_next(iterator_t* it, void** data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue