[daemon-fix] fixed querying about name information
[platform/upstream/dbus.git] / dbus / dbus-string-private.h
index 500e0b7..2e6de90 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef DBUS_STRING_PRIVATE_H
 #define DBUS_STRING_PRIVATE_H
 
+#include <dbus/dbus-internals.h>
 #include <dbus/dbus-memory.h>
 #include <dbus/dbus-types.h>
 
@@ -44,13 +45,13 @@ typedef struct
   unsigned char *str;            /**< String data, plus nul termination */
   int            len;            /**< Length without nul */
   int            allocated;      /**< Allocated size of data */
-  int            max_length;     /**< Max length of this string, without nul byte */
   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   align_offset : 3; /**< str - align_offset is the actual malloc block */
 } DBusRealString;
 
+_DBUS_STATIC_ASSERT (sizeof (DBusRealString) == sizeof (DBusString));
 
 /**
  * @defgroup DBusStringInternals DBusString implementation details
@@ -63,10 +64,9 @@ typedef struct
  */
 
 /**
- * This is the maximum max length (and thus also the maximum length)
- * of a DBusString
+ * The maximum length of a DBusString
  */
-#define _DBUS_STRING_MAX_MAX_LENGTH (_DBUS_INT32_MAX - _DBUS_STRING_ALLOCATION_PADDING)
+#define _DBUS_STRING_MAX_LENGTH (_DBUS_INT32_MAX - _DBUS_STRING_ALLOCATION_PADDING)
 
 /**
  * Checks a bunch of assertions about a string object
@@ -75,13 +75,13 @@ typedef struct
  */
 #define DBUS_GENERIC_STRING_PREAMBLE(real) \
   do { \
+      (void) real; /* might be unused unless asserting */ \
       _dbus_assert ((real) != NULL); \
       _dbus_assert (!(real)->invalid); \
       _dbus_assert ((real)->len >= 0); \
       _dbus_assert ((real)->allocated >= 0); \
-      _dbus_assert ((real)->max_length >= 0); \
       _dbus_assert ((real)->len <= ((real)->allocated - _DBUS_STRING_ALLOCATION_PADDING)); \
-      _dbus_assert ((real)->len <= (real)->max_length); \
+      _dbus_assert ((real)->len <= _DBUS_STRING_MAX_LENGTH); \
   } while (0)
 
 /**