save works
This commit is contained in:
parent
acfbec875b
commit
3f74f14687
38 changed files with 751 additions and 448 deletions
|
|
@ -456,7 +456,6 @@ static int xzarray_store(meta_obj_t* obj, void* data)
|
|||
xzarray_private_t* priv = (xzarray_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
int rc = 0;
|
||||
|
||||
mylock_lock(&(priv->lock));
|
||||
rc = xzarray_ensure_items(a, a->count + 1);
|
||||
if (rc >= 0) {
|
||||
int idx, i;
|
||||
|
|
@ -484,7 +483,6 @@ static int xzarray_store(meta_obj_t* obj, void* data)
|
|||
a->pos = (rc + 1) % a->caps;
|
||||
}
|
||||
}
|
||||
mylock_unlock(&(priv->lock));
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -499,7 +497,6 @@ static int xzarray_get_vec(meta_obj_t* obj, int count, int* idxs, void** data)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
mylock_lock(&(priv->lock));
|
||||
for (i = 0; i < count; i++) {
|
||||
int idx = idxs[i];
|
||||
|
||||
|
|
@ -516,7 +513,6 @@ static int xzarray_get_vec(meta_obj_t* obj, int count, int* idxs, void** data)
|
|||
data[i] = a->data[idx].data;
|
||||
}
|
||||
}
|
||||
mylock_unlock(&(priv->lock));
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -537,7 +533,6 @@ static int xzarray_put_vec(meta_obj_t* obj, int count, int* idxs, void** data)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
mylock_lock(&(priv->lock));
|
||||
maxid = 0;
|
||||
rc = 0;
|
||||
|
||||
|
|
@ -570,8 +565,6 @@ static int xzarray_put_vec(meta_obj_t* obj, int count, int* idxs, void** data)
|
|||
}
|
||||
}
|
||||
|
||||
mylock_unlock(&(priv->lock));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -588,7 +581,6 @@ static int xzarray_clear(meta_obj_t* obj, int idx)
|
|||
xzarray_private_t* priv = (xzarray_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
int rc = -EINVAL;
|
||||
|
||||
mylock_lock(&(priv->lock));
|
||||
if (idx < a->caps) {
|
||||
rc = 0;
|
||||
if (a->data[idx].inuse) {
|
||||
|
|
@ -601,7 +593,6 @@ static int xzarray_clear(meta_obj_t* obj, int idx)
|
|||
a->data[idx].data = NULL;
|
||||
a->pos = idx; /* we can find the available idx next time */
|
||||
}
|
||||
mylock_unlock(&(priv->lock));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -610,7 +601,6 @@ static int xzarray_make_iter(iterator_t* iter, va_list ap)
|
|||
{
|
||||
xzarray_private_t* priv = (xzarray_private_t*)RTTI_OBJ_TO_PRIV(iter->obj);
|
||||
|
||||
mylock_lock(&(priv->lock));
|
||||
iter->data = (void*)(long)0;
|
||||
|
||||
return RTTI_ITER_OK;
|
||||
|
|
@ -640,12 +630,26 @@ static int xzarray_iter_reset(iterator_t* iter)
|
|||
return RTTI_ITER_OK;
|
||||
}
|
||||
|
||||
static int xzarray_lock(meta_obj_t* obj, uint64_t option)
|
||||
{
|
||||
xzarray_private_t* priv = (xzarray_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
|
||||
return mylock_lock(&(priv->lock));
|
||||
}
|
||||
|
||||
static void xzarray_unlock(meta_obj_t* obj)
|
||||
{
|
||||
xzarray_private_t* priv = (xzarray_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
|
||||
mylock_unlock(&(priv->lock));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void xzarray_iter_destroy(iterator_t* iter)
|
||||
{
|
||||
xzarray_private_t* priv = (xzarray_private_t*)RTTI_OBJ_TO_PRIV(iter->obj);
|
||||
|
||||
mylock_unlock(&(priv->lock));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -667,5 +671,7 @@ typeinfo_t xzarray_type = {
|
|||
.next = (iter_next_fn_t)xzarray_iter_next,
|
||||
.reset = (iter_reset_fn_t)xzarray_iter_reset,
|
||||
.destroy
|
||||
= (iter_destroy_fn_t)xzarray_iter_destroy } }
|
||||
= (iter_destroy_fn_t)xzarray_iter_destroy },
|
||||
.lock = &(intf_lock_t) { .lock = (lock_fn_t)xzarray_lock,
|
||||
.unlock = (unlock_fn_t)xzarray_unlock } }
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue