fix vclear
This commit is contained in:
parent
277bc31225
commit
cbda3378da
2 changed files with 10 additions and 10 deletions
17
src/varray.c
17
src/varray.c
|
|
@ -65,25 +65,24 @@ int vput(var v, int idx, void* data)
|
|||
return method(obj, idx, data);
|
||||
}
|
||||
|
||||
void vclear(var v)
|
||||
int vclear(var v, int idx)
|
||||
{
|
||||
meta_obj_t* obj = NULL;
|
||||
vclear_fn_t method = NULL;
|
||||
|
||||
if (idx < 0) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
obj = RTTI_DATA_TO_OBJ(v);
|
||||
if (RTTI_OBJ_INVALID(obj)) {
|
||||
errno = EINVAL;
|
||||
return;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
RTTI_GET_METHOD(method, obj, varray, vclear);
|
||||
if (method == NULL) {
|
||||
errno = EINVAL;
|
||||
|
||||
return;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
method(obj);
|
||||
|
||||
return;
|
||||
return method(obj, idx);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue