Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*
@@ -1099,22 +1099,22 @@
/*
* If a session has a reference to a dprov_object_t,
* it REFHOLD()s.
*/
#define DPROV_OBJECT_REFHOLD(object) { \
- atomic_add_32(&(object)->do_refcnt, 1); \
+ atomic_inc_32(&(object)->do_refcnt); \
ASSERT((object)->do_refcnt != 0); \
}
/*
* Releases a reference to an object. When the last
* reference is released, the object is freed.
*/
#define DPROV_OBJECT_REFRELE(object) { \
ASSERT((object)->do_refcnt != 0); \
membar_exit(); \
- if (atomic_add_32_nv(&(object)->do_refcnt, -1) == 0) \
+ if (atomic_dec_32_nv(&(object)->do_refcnt) == 0) \
dprov_free_object(object); \
}
/*
* Object attributes are passed to the provider using crypto_object_attribute