Main Page   Modules   Data Structures   File List   Data Fields   Related Pages  

DBusString implementation details
[D-BUS internal implementation details]

DBusString implementation details. More...

Defines

#define ALLOCATION_PADDING   8
 We allocate 1 byte for nul termination, plus 7 bytes for possible align_offset, so we always need 8 bytes on top of the string's length to be in the allocated block.

#define MAX_MAX_LENGTH   (_DBUS_INT_MAX - ALLOCATION_PADDING)
 This is the maximum max length (and thus also the maximum length) of a DBusString.

#define DBUS_GENERIC_STRING_PREAMBLE(real)   _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 - ALLOCATION_PADDING)); _dbus_assert ((real)->len <= (real)->max_length)
 Checks a bunch of assertions about a string object. More...

#define DBUS_STRING_PREAMBLE(str)
 Checks assertions about a string object that needs to be modifiable - may not be locked or const. More...

#define DBUS_LOCKED_STRING_PREAMBLE(str)
 Checks assertions about a string object that may be locked but can't be const. More...

#define DBUS_CONST_STRING_PREAMBLE(str)
 Checks assertions about a string that may be const or locked. More...


Functions

dbus_bool_t _dbus_string_test (void)

Detailed Description

DBusString implementation details.

The guts of DBusString.


Define Documentation

#define DBUS_CONST_STRING_PREAMBLE str   
 

Value:

const DBusRealString *real = (DBusRealString*) str; \
  DBUS_GENERIC_STRING_PREAMBLE (real)
Checks assertions about a string that may be const or locked.

Also declares the "real" variable pointing to DBusRealString.

Parameters:
str  the string.

Definition at line 121 of file dbus-string.c.

#define DBUS_GENERIC_STRING_PREAMBLE real       _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 - ALLOCATION_PADDING)); _dbus_assert ((real)->len <= (real)->max_length)
 

Checks a bunch of assertions about a string object.

Parameters:
real  the DBusRealString

Definition at line 92 of file dbus-string.c.

#define DBUS_LOCKED_STRING_PREAMBLE str   
 

Value:

DBusRealString *real = (DBusRealString*) str; \
  DBUS_GENERIC_STRING_PREAMBLE (real);                                                 \
  _dbus_assert (!(real)->constant)
Checks assertions about a string object that may be locked but can't be const.

i.e. a string object that we can free. Also declares the "real" variable pointing to DBusRealString.

Parameters:
str  the string

Definition at line 112 of file dbus-string.c.

#define DBUS_STRING_PREAMBLE str   
 

Value:

DBusRealString *real = (DBusRealString*) str; \
  DBUS_GENERIC_STRING_PREAMBLE (real);                                          \
  _dbus_assert (!(real)->constant);                                             \
  _dbus_assert (!(real)->locked)
Checks assertions about a string object that needs to be modifiable - may not be locked or const.

Also declares the "real" variable pointing to DBusRealString.

Parameters:
str  the string

Definition at line 100 of file dbus-string.c.


Function Documentation

dbus_bool_t _dbus_string_test void   
 

Unit test for DBusString.

Todo:
Need to write tests for _dbus_string_copy() and _dbus_string_move() moving to/from each of start/middle/end of a string. Also need tests for _dbus_string_move_len ()

Returns:
TRUE on success.

Definition at line 3059 of file dbus-string.c.


Generated on Wed Jun 9 05:01:28 2004 for D-BUS by doxygen1.2.15