lib/portableproplib: fixes to allow building with NDEBUG (assert()s disabled).
This commit is contained in:
parent
ae9363b620
commit
e23c64bc84
@ -278,7 +278,10 @@ _prop_dict_keysym_equals(prop_object_t v1, prop_object_t v2,
|
|||||||
static prop_dictionary_keysym_t
|
static prop_dictionary_keysym_t
|
||||||
_prop_dict_keysym_alloc(const char *key)
|
_prop_dict_keysym_alloc(const char *key)
|
||||||
{
|
{
|
||||||
prop_dictionary_keysym_t opdk, pdk, rpdk;
|
#ifdef DEBUG
|
||||||
|
prop_dictionary_keysym_t rpdk;
|
||||||
|
#endif
|
||||||
|
prop_dictionary_keysym_t opdk, pdk;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
_PROP_ONCE_RUN(_prop_dict_init_once, _prop_dict_init);
|
_PROP_ONCE_RUN(_prop_dict_init_once, _prop_dict_init);
|
||||||
@ -331,8 +334,10 @@ _prop_dict_keysym_alloc(const char *key)
|
|||||||
_prop_dict_keysym_put(pdk);
|
_prop_dict_keysym_put(pdk);
|
||||||
return (opdk);
|
return (opdk);
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
rpdk = _prop_rb_tree_insert_node(&_prop_dict_keysym_tree, pdk);
|
rpdk = _prop_rb_tree_insert_node(&_prop_dict_keysym_tree, pdk);
|
||||||
_PROP_ASSERT(rpdk == pdk);
|
_PROP_ASSERT(rpdk == pdk);
|
||||||
|
#endif
|
||||||
_PROP_MUTEX_UNLOCK(_prop_dict_keysym_tree_mutex);
|
_PROP_MUTEX_UNLOCK(_prop_dict_keysym_tree_mutex);
|
||||||
return (pdk);
|
return (pdk);
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,10 @@ _prop_number_equals(prop_object_t v1, prop_object_t v2,
|
|||||||
static prop_number_t
|
static prop_number_t
|
||||||
_prop_number_alloc(const struct _prop_number_value *pnv)
|
_prop_number_alloc(const struct _prop_number_value *pnv)
|
||||||
{
|
{
|
||||||
prop_number_t opn, pn, rpn;
|
#ifdef DEBUG
|
||||||
|
prop_number_t rpn;
|
||||||
|
#endif
|
||||||
|
prop_number_t opn, pn;
|
||||||
|
|
||||||
_PROP_ONCE_RUN(_prop_number_init_once, _prop_number_init);
|
_PROP_ONCE_RUN(_prop_number_init_once, _prop_number_init);
|
||||||
|
|
||||||
@ -305,8 +308,10 @@ _prop_number_alloc(const struct _prop_number_value *pnv)
|
|||||||
_PROP_POOL_PUT(_prop_number_pool, pn);
|
_PROP_POOL_PUT(_prop_number_pool, pn);
|
||||||
return (opn);
|
return (opn);
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
rpn = _prop_rb_tree_insert_node(&_prop_number_tree, pn);
|
rpn = _prop_rb_tree_insert_node(&_prop_number_tree, pn);
|
||||||
_PROP_ASSERT(rpn == pn);
|
_PROP_ASSERT(rpn == pn);
|
||||||
|
#endif
|
||||||
_PROP_MUTEX_UNLOCK(_prop_number_tree_mutex);
|
_PROP_MUTEX_UNLOCK(_prop_number_tree_mutex);
|
||||||
return (pn);
|
return (pn);
|
||||||
}
|
}
|
||||||
|
@ -997,14 +997,18 @@ _PROP_MUTEX_DECL_STATIC(_prop_refcnt_mutex)
|
|||||||
void
|
void
|
||||||
prop_object_retain(prop_object_t obj)
|
prop_object_retain(prop_object_t obj)
|
||||||
{
|
{
|
||||||
struct _prop_object *po = obj;
|
#ifdef DEBUG
|
||||||
uint32_t ocnt;
|
uint32_t ocnt;
|
||||||
|
#endif
|
||||||
|
struct _prop_object *po = obj;
|
||||||
|
|
||||||
_PROP_REFCNT_LOCK();
|
_PROP_REFCNT_LOCK();
|
||||||
ocnt = po->po_refcnt++;
|
po->po_refcnt++;
|
||||||
_PROP_REFCNT_UNLOCK();
|
#ifdef DEBUG
|
||||||
|
ocnt = po->po_refcnt;
|
||||||
_PROP_ASSERT(ocnt != 0xffffffffU);
|
_PROP_ASSERT(ocnt != 0xffffffffU);
|
||||||
|
#endif
|
||||||
|
_PROP_REFCNT_UNLOCK();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user