24 #ifndef DBUS_STRING_PRIVATE_H
25 #define DBUS_STRING_PRIVATE_H
27 #include <dbus/dbus-internals.h>
28 #include <dbus/dbus-memory.h>
29 #include <dbus/dbus-types.h>
31 #ifndef DBUS_CAN_USE_DBUS_STRING_PRIVATE
32 #error "Don't go including dbus-string-private.h for no good reason"
48 unsigned int constant : 1;
49 unsigned int locked : 1;
50 unsigned int invalid : 1;
51 unsigned int align_offset : 3;
69 #define _DBUS_STRING_MAX_LENGTH (_DBUS_INT32_MAX - _DBUS_STRING_ALLOCATION_PADDING)
76 #define DBUS_GENERIC_STRING_PREAMBLE(real) \
79 _dbus_assert ((real) != NULL); \
80 _dbus_assert (!(real)->invalid); \
81 _dbus_assert ((real)->len >= 0); \
82 _dbus_assert ((real)->allocated >= 0); \
83 _dbus_assert ((real)->len <= ((real)->allocated - _DBUS_STRING_ALLOCATION_PADDING)); \
84 _dbus_assert ((real)->len <= _DBUS_STRING_MAX_LENGTH); \
93 #define DBUS_STRING_PREAMBLE(str) DBusRealString *real = (DBusRealString*) str; \
94 DBUS_GENERIC_STRING_PREAMBLE (real); \
95 _dbus_assert (!(real)->constant); \
96 _dbus_assert (!(real)->locked)
105 #define DBUS_LOCKED_STRING_PREAMBLE(str) DBusRealString *real = (DBusRealString*) str; \
106 DBUS_GENERIC_STRING_PREAMBLE (real); \
107 _dbus_assert (!(real)->constant)
114 #define DBUS_CONST_STRING_PREAMBLE(str) const DBusRealString *real = (DBusRealString*) str; \
115 DBUS_GENERIC_STRING_PREAMBLE (real)
121 #define DBUS_IS_ASCII_BLANK(c) ((c) == ' ' || (c) == '\t')
127 #define DBUS_IS_ASCII_WHITE(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\r')