int allocated; /**< Allocated size of data */
unsigned int constant : 1; /**< String data is not owned by DBusString */
unsigned int locked : 1; /**< DBusString has been locked and can't be changed */
- unsigned int invalid : 1; /**< DBusString is invalid (e.g. already freed) */
+ unsigned int valid : 1; /**< DBusString is valid (initialized and not freed) */
unsigned int align_offset : 3; /**< str - align_offset is the actual malloc block */
} DBusRealString;
do { \
(void) real; /* might be unused unless asserting */ \
_dbus_assert ((real) != NULL); \
- _dbus_assert (!(real)->invalid); \
+ _dbus_assert ((real)->valid); \
_dbus_assert ((real)->len >= 0); \
_dbus_assert ((real)->allocated >= 0); \
_dbus_assert ((real)->len <= ((real)->allocated - _DBUS_STRING_ALLOCATION_PADDING)); \
_dbus_assert (real_test_static_string->allocated > 5);
_dbus_assert (real_test_static_string->constant);
_dbus_assert (real_test_static_string->locked);
- _dbus_assert (!real_test_static_string->invalid);
+ _dbus_assert (real_test_static_string->valid);
_dbus_assert (real_test_static_string->align_offset == 0);
/* Test shortening and setting length */
real->constant = FALSE;
real->locked = FALSE;
- real->invalid = FALSE;
+ real->valid = TRUE;
real->align_offset = 0;
fixup_alignment (real);
real->allocated = real->len + _DBUS_STRING_ALLOCATION_PADDING; /* a lie, just to avoid special-case assertions... */
real->constant = TRUE;
real->locked = TRUE;
- real->invalid = FALSE;
+ real->valid = TRUE;
real->align_offset = 0;
/* We don't require const strings to be 8-byte aligned as the
dbus_free (real->str - real->align_offset);
- real->invalid = TRUE;
+ real->valid = FALSE;
}
static dbus_bool_t
sizeof(_dbus_static_string_##name) - 1, \
sizeof(_dbus_static_string_##name) + \
_DBUS_STRING_ALLOCATION_PADDING, \
- TRUE, TRUE, FALSE, 0 }
+ TRUE, TRUE, TRUE, 0 }
DBUS_END_DECLS