diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2011-07-16 14:14:13 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2011-07-16 14:14:13 -0700 |
commit | daf36f07473b627ef634f8f66379a45ac99d32fc (patch) | |
tree | 96212a3f25627b89ea7a1bab6fa576252c045a2e /upb/atomic.h | |
parent | b6ca2718c8e9fcb601054b76af96e22920a2070e (diff) |
Get rid of upb_symtabtxn.
This type was nothing but a map of defs.
We can as easily just pass an array of defs
into upb_symtab_add().
Diffstat (limited to 'upb/atomic.h')
-rw-r--r-- | upb/atomic.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/upb/atomic.h b/upb/atomic.h index 53501b5..d2b2bd2 100644 --- a/upb/atomic.h +++ b/upb/atomic.h @@ -20,6 +20,7 @@ #define UPB_ATOMIC_H_ #include <stdbool.h> +#include <assert.h> #ifdef __cplusplus extern "C" { @@ -45,7 +46,7 @@ typedef struct { INLINE void upb_atomic_init(upb_atomic_t *a, int val) { a->v = val; } INLINE bool upb_atomic_ref(upb_atomic_t *a) { return a->v++ == 0; } -INLINE bool upb_atomic_unref(upb_atomic_t *a) { return --a->v == 0; } +INLINE bool upb_atomic_unref(upb_atomic_t *a) { assert(a->v > 0); return --a->v == 0; } INLINE int upb_atomic_read(upb_atomic_t *a) { return a->v; } INLINE bool upb_atomic_add(upb_atomic_t *a, int val) { a->v += val; |