DBusString class
[D-Bus secret internal implementation details]

DBusString data structure for safer string handling. More...

Defines

#define ASSIGN_2_OCTETS(p, octets)   *((dbus_uint16_t*)(p)) = *((dbus_uint16_t*)(octets));
 assign 2 bytes from one string to another
#define ASSIGN_4_OCTETS(p, octets)   *((dbus_uint32_t*)(p)) = *((dbus_uint32_t*)(octets));
 assign 4 bytes from one string to another
#define ASSIGN_8_OCTETS(p, octets)   *((dbus_uint64_t*)(p)) = *((dbus_uint64_t*)(octets));
 assign 8 bytes from one string to another
#define DBUS_STRING_COPY_PREAMBLE(source, start, dest, insert_at)
 Checks assertions for two strings we're copying a segment between, and declares real_source/real_dest variables.
#define UTF8_COMPUTE(Char, Mask, Len)
 computes length and mask of a unicode character
#define UTF8_LENGTH(Char)
 computes length of a unicode character in UTF-8
#define UTF8_GET(Result, Chars, Count, Mask, Len)
 Gets a UTF-8 value.
#define UNICODE_VALID(Char)
 Check whether a unicode char is in a valid range.

Functions

dbus_bool_t _dbus_string_ends_with_c_str (const DBusString *a, const char *c_str)
 Returns whether a string ends with the given suffix.
dbus_bool_t _dbus_string_find_byte_backward (const DBusString *str, int start, unsigned char byte, int *found)
 Find the given byte scanning backward from the given start.
dbus_bool_t _dbus_string_init_preallocated (DBusString *str, int allocate_size)
 Initializes a string that can be up to the given allocation size before it has to realloc.
dbus_bool_t _dbus_string_init (DBusString *str)
 Initializes a string.
void _dbus_string_init_const (DBusString *str, const char *value)
 Initializes a constant string.
void _dbus_string_init_const_len (DBusString *str, const char *value, int len)
 Initializes a constant string with a length.
void _dbus_string_free (DBusString *str)
 Frees a string created by _dbus_string_init().
dbus_bool_t _dbus_string_compact (DBusString *str, int max_waste)
 Compacts the string to avoid wasted memory.
char * _dbus_string_get_data_len (DBusString *str, int start, int len)
 Gets a sub-portion of the raw character buffer from the string.
dbus_bool_t _dbus_string_insert_bytes (DBusString *str, int i, int n_bytes, unsigned char byte)
 Inserts a number of bytes of a given value at the given position.
dbus_bool_t _dbus_string_insert_byte (DBusString *str, int i, unsigned char byte)
 Inserts a single byte at the given position.
dbus_bool_t _dbus_string_steal_data (DBusString *str, char **data_return)
 Like _dbus_string_get_data(), but removes the gotten data from the original string.
dbus_bool_t _dbus_string_copy_data (const DBusString *str, char **data_return)
 Copies the data from the string into a char*.
void _dbus_string_copy_to_buffer (const DBusString *str, char *buffer, int avail_len)
 Copies the contents of a DBusString into a different buffer.
void _dbus_string_copy_to_buffer_with_nul (const DBusString *str, char *buffer, int avail_len)
 Copies the contents of a DBusString into a different buffer.
dbus_bool_t _dbus_string_lengthen (DBusString *str, int additional_length)
 Makes a string longer by the given number of bytes.
void _dbus_string_shorten (DBusString *str, int length_to_remove)
 Makes a string shorter by the given number of bytes.
dbus_bool_t _dbus_string_set_length (DBusString *str, int length)
 Sets the length of a string.
dbus_bool_t _dbus_string_align_length (DBusString *str, int alignment)
 Align the length of a string to a specific alignment (typically 4 or 8) by appending nul bytes to the string.
dbus_bool_t _dbus_string_alloc_space (DBusString *str, int extra_bytes)
 Preallocate extra_bytes such that a future lengthening of the string by extra_bytes is guaranteed to succeed without an out of memory error.
dbus_bool_t _dbus_string_append (DBusString *str, const char *buffer)
 Appends a nul-terminated C-style string to a DBusString.
dbus_bool_t _dbus_string_insert_2_aligned (DBusString *str, int insert_at, const unsigned char octets[4])
 Inserts 2 bytes aligned on a 2 byte boundary with any alignment padding initialized to 0.
dbus_bool_t _dbus_string_insert_4_aligned (DBusString *str, int insert_at, const unsigned char octets[4])
 Inserts 4 bytes aligned on a 4 byte boundary with any alignment padding initialized to 0.
dbus_bool_t _dbus_string_insert_8_aligned (DBusString *str, int insert_at, const unsigned char octets[8])
 Inserts 8 bytes aligned on an 8 byte boundary with any alignment padding initialized to 0.
dbus_bool_t _dbus_string_insert_alignment (DBusString *str, int *insert_at, int alignment)
 Inserts padding at *insert_at such to align it to the given boundary.
dbus_bool_t _dbus_string_append_printf_valist (DBusString *str, const char *format, va_list args)
 Appends a printf-style formatted string to the DBusString.
dbus_bool_t _dbus_string_append_printf (DBusString *str, const char *format,...)
 Appends a printf-style formatted string to the DBusString.
dbus_bool_t _dbus_string_append_len (DBusString *str, const char *buffer, int len)
 Appends block of bytes with the given length to a DBusString.
dbus_bool_t _dbus_string_append_byte (DBusString *str, unsigned char byte)
 Appends a single byte to the string, returning FALSE if not enough memory.
void _dbus_string_delete (DBusString *str, int start, int len)
 Deletes a segment of a DBusString with length len starting at start.
dbus_bool_t _dbus_string_move (DBusString *source, int start, DBusString *dest, int insert_at)
 Moves the end of one string into another string.
dbus_bool_t _dbus_string_copy (const DBusString *source, int start, DBusString *dest, int insert_at)
 Like _dbus_string_move(), but does not delete the section of the source string that's copied to the dest string.
dbus_bool_t _dbus_string_move_len (DBusString *source, int start, int len, DBusString *dest, int insert_at)
 Like _dbus_string_move(), but can move a segment from the middle of the source string.
dbus_bool_t _dbus_string_copy_len (const DBusString *source, int start, int len, DBusString *dest, int insert_at)
 Like _dbus_string_copy(), but can copy a segment from the middle of the source string.
dbus_bool_t _dbus_string_replace_len (const DBusString *source, int start, int len, DBusString *dest, int replace_at, int replace_len)
 Replaces a segment of dest string with a segment of source string.
dbus_bool_t _dbus_string_find (const DBusString *str, int start, const char *substr, int *found)
 Finds the given substring in the string, returning TRUE and filling in the byte index where the substring was found, if it was found.
dbus_bool_t _dbus_string_find_eol (const DBusString *str, int start, int *found, int *found_len)
 Finds end of line ("\r\n" or "\n") in the string, returning TRUE and filling in the byte index where the eol string was found, if it was found.
dbus_bool_t _dbus_string_find_to (const DBusString *str, int start, int end, const char *substr, int *found)
 Finds the given substring in the string, up to a certain position, returning TRUE and filling in the byte index where the substring was found, if it was found.
dbus_bool_t _dbus_string_find_blank (const DBusString *str, int start, int *found)
 Finds a blank (space or tab) in the string.
void _dbus_string_skip_blank (const DBusString *str, int start, int *end)
 Skips blanks from start, storing the first non-blank in *end (blank is space or tab).
void _dbus_string_skip_white (const DBusString *str, int start, int *end)
 Skips whitespace from start, storing the first non-whitespace in *end.
void _dbus_string_skip_white_reverse (const DBusString *str, int end, int *start)
 Skips whitespace from end, storing the start index of the trailing whitespace in *start.
dbus_bool_t _dbus_string_pop_line (DBusString *source, DBusString *dest)
 Assigns a newline-terminated or \r\n-terminated line from the front of the string to the given dest string.
void _dbus_string_chop_white (DBusString *str)
 Deletes leading and trailing whitespace.
dbus_bool_t _dbus_string_equal (const DBusString *a, const DBusString *b)
 Tests two DBusString for equality.
dbus_bool_t _dbus_string_equal_substring (const DBusString *a, int a_start, int a_len, const DBusString *b, int b_start)
 Tests two sub-parts of two DBusString for equality.
dbus_bool_t _dbus_string_equal_c_str (const DBusString *a, const char *c_str)
 Checks whether a string is equal to a C string.
dbus_bool_t _dbus_string_append_byte_as_hex (DBusString *str, int byte)
 Appends a two-character hex digit to a string, where the hex digit has the value of the given byte.
dbus_bool_t _dbus_string_hex_encode (const DBusString *source, int start, DBusString *dest, int insert_at)
 Encodes a string in hex, the way MD5 and SHA-1 are usually encoded.
dbus_bool_t _dbus_string_hex_decode (const DBusString *source, int start, int *end_return, DBusString *dest, int insert_at)
 Decodes a string from hex encoding.
dbus_bool_t _dbus_string_validate_ascii (const DBusString *str, int start, int len)
 Checks that the given range of the string is valid ASCII with no nul bytes.
dbus_bool_t _dbus_string_validate_utf8 (const DBusString *str, int start, int len)
 Checks that the given range of the string is valid UTF-8.
dbus_bool_t _dbus_string_validate_nul (const DBusString *str, int start, int len)
 Checks that the given range of the string is all nul bytes.
void _dbus_string_zero (DBusString *str)
 Clears all allocated bytes in the string to zero.
dbus_bool_t _dbus_string_get_dirname (const DBusString *filename, DBusString *dirname)
 Get the directory name from a complete filename.
dbus_bool_t _dbus_string_append_int (DBusString *str, long value)
 Appends an integer to a DBusString.
dbus_bool_t _dbus_string_append_uint (DBusString *str, unsigned long value)
 Appends an unsigned integer to a DBusString.
dbus_bool_t _dbus_string_parse_int (const DBusString *str, int start, long *value_return, int *end_return)
 Parses an integer contained in a DBusString.
dbus_bool_t _dbus_string_parse_uint (const DBusString *str, int start, unsigned long *value_return, int *end_return)
 Parses an unsigned integer contained in a DBusString.

Detailed Description

DBusString data structure for safer string handling.

Types and functions related to DBusString. DBusString is intended to be a string class that makes it hard to mess up security issues (and just in general harder to write buggy code). It should be used (or extended and then used) rather than the libc stuff in string.h. The string class is a bit inconvenient at spots because it handles out-of-memory failures and tries to be extra-robust.

A DBusString has a maximum length set at initialization time; this can be used to ensure that a buffer doesn't get too big. The _dbus_string_lengthen() method checks for overflow, and for max length being exceeded.

Try to avoid conversion to a plain C string, i.e. add methods on the string object instead, only convert to C string when passing things out to the public API. In particular, no sprintf, strcpy, strcat, any of that should be used. The GString feature of accepting negative numbers for "length of string" is also absent, because it could keep us from detecting bogus huge lengths. i.e. if we passed in some bogus huge length it would be taken to mean "current length of string" instead of "broken crack"

Todo:
DBusString needs a lot of cleaning up; some of the API is no longer used, and the API is pretty inconsistent. In particular all the "append" APIs, especially those involving alignment but probably lots of them, are no longer used by the marshaling code which always does "inserts" now.

Define Documentation

#define DBUS_STRING_COPY_PREAMBLE ( source,
start,
dest,
insert_at   ) 

Value:

DBusRealString *real_source = (DBusRealString*) source;               \
  DBusRealString *real_dest = (DBusRealString*) dest;                   \
  _dbus_assert ((source) != (dest));                                    \
  DBUS_GENERIC_STRING_PREAMBLE (real_source);                           \
  DBUS_GENERIC_STRING_PREAMBLE (real_dest);                             \
  _dbus_assert (!real_dest->constant);                                  \
  _dbus_assert (!real_dest->locked);                                    \
  _dbus_assert ((start) >= 0);                                          \
  _dbus_assert ((start) <= real_source->len);                           \
  _dbus_assert ((insert_at) >= 0);                                      \
  _dbus_assert ((insert_at) <= real_dest->len)
Checks assertions for two strings we're copying a segment between, and declares real_source/real_dest variables.

Parameters:
source the source string
start the starting offset
dest the dest string
insert_at where the copied segment is inserted

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

Referenced by _dbus_string_copy(), _dbus_string_copy_len(), _dbus_string_move_len(), and _dbus_string_replace_len().

#define UNICODE_VALID ( Char   ) 

Value:

((Char) < 0x110000 &&                     \
     (((Char) & 0xFFFFF800) != 0xD800) &&     \
     ((Char) < 0xFDD0 || (Char) > 0xFDEF) &&  \
     ((Char) & 0xFFFF) != 0xFFFF)
Check whether a unicode char is in a valid range.

Parameters:
Char the character

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

Referenced by _dbus_string_validate_utf8().

#define UTF8_COMPUTE ( Char,
Mask,
Len   ) 

computes length and mask of a unicode character

Parameters:
Char the char
Mask the mask variable to assign to
Len the length variable to assign to

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

Referenced by _dbus_string_validate_utf8().

#define UTF8_GET ( Result,
Chars,
Count,
Mask,
Len   ) 

Value:

(Result) = (Chars)[0] & (Mask);                                       \
  for ((Count) = 1; (Count) < (Len); ++(Count))                               \
    {                                                                         \
      if (((Chars)[(Count)] & 0xc0) != 0x80)                                  \
        {                                                                     \
          (Result) = -1;                                                      \
          break;                                                              \
        }                                                                     \
      (Result) <<= 6;                                                         \
      (Result) |= ((Chars)[(Count)] & 0x3f);                                  \
    }
Gets a UTF-8 value.

Parameters:
Result variable for extracted unicode char.
Chars the bytes to decode
Count counter variable
Mask mask for this char
Len length for this char in bytes

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

Referenced by _dbus_string_validate_utf8().

#define UTF8_LENGTH ( Char   ) 

Value:

((Char) < 0x80 ? 1 :                 \
   ((Char) < 0x800 ? 2 :               \
    ((Char) < 0x10000 ? 3 :            \
     ((Char) < 0x200000 ? 4 :          \
      ((Char) < 0x4000000 ? 5 : 6)))))
computes length of a unicode character in UTF-8

Parameters:
Char the char

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

Referenced by _dbus_string_validate_utf8().


Function Documentation

dbus_bool_t _dbus_string_align_length ( DBusString str,
int  alignment 
)

Align the length of a string to a specific alignment (typically 4 or 8) by appending nul bytes to the string.

Parameters:
str a string
alignment the alignment
Returns:
FALSE if no memory

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

dbus_bool_t _dbus_string_alloc_space ( DBusString str,
int  extra_bytes 
)

Preallocate extra_bytes such that a future lengthening of the string by extra_bytes is guaranteed to succeed without an out of memory error.

Parameters:
str a string
extra_bytes bytes to alloc
Returns:
FALSE if no memory

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

References _dbus_string_lengthen(), _dbus_string_shorten(), FALSE, and TRUE.

Referenced by _dbus_type_writer_write_basic().

dbus_bool_t _dbus_string_append ( DBusString str,
const char *  buffer 
)

dbus_bool_t _dbus_string_append_byte ( DBusString str,
unsigned char  byte 
)

Appends a single byte to the string, returning FALSE if not enough memory.

Parameters:
str the string
byte the byte to append
Returns:
TRUE on success

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

References DBUS_STRING_PREAMBLE, FALSE, DBusRealString::len, DBusRealString::str, and TRUE.

Referenced by _dbus_address_append_escaped(), _dbus_concat_dir_and_file(), _dbus_string_append_byte_as_hex(), and _dbus_string_hex_decode().

dbus_bool_t _dbus_string_append_byte_as_hex ( DBusString str,
int  byte 
)

Appends a two-character hex digit to a string, where the hex digit has the value of the given byte.

Parameters:
str the string
byte the byte
Returns:
FALSE if no memory

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

References _dbus_string_append_byte(), _dbus_string_set_length(), FALSE, and TRUE.

Referenced by _dbus_address_append_escaped(), and _dbus_string_hex_encode().

dbus_bool_t _dbus_string_append_int ( DBusString str,
long  value 
)

Appends an integer to a DBusString.

Parameters:
str the string
value the integer value
Returns:
FALSE if not enough memory or other failure.

Definition at line 399 of file dbus-sysdeps.c.

References _dbus_string_get_data_len(), _dbus_string_lengthen(), _dbus_string_shorten(), FALSE, and TRUE.

Referenced by _dbus_write_pid_to_file_and_pipe().

dbus_bool_t _dbus_string_append_len ( DBusString str,
const char *  buffer,
int  len 
)

Appends block of bytes with the given length to a DBusString.

Parameters:
str the DBusString
buffer the bytes to append
len the number of bytes to append
Returns:
FALSE if not enough memory.

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

References _dbus_assert, DBUS_STRING_PREAMBLE, and NULL.

Referenced by _dbus_sha_final(), dbus_message_demarshal(), dbus_message_iter_get_signature(), and dbus_signature_iter_get_signature().

dbus_bool_t _dbus_string_append_printf ( DBusString str,
const char *  format,
  ... 
)

Appends a printf-style formatted string to the DBusString.

Parameters:
str the string
format printf format
Returns:
FALSE if no memory

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

References _dbus_string_append_printf_valist().

Referenced by _dbus_command_for_pid(), and dbus_connection_dispatch().

dbus_bool_t _dbus_string_append_printf_valist ( DBusString str,
const char *  format,
va_list  args 
)

Appends a printf-style formatted string to the DBusString.

Parameters:
str the string
format printf format
args variable argument list
Returns:
FALSE if no memory

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

References _dbus_printf_string_upper_bound(), _dbus_string_lengthen(), DBUS_STRING_PREAMBLE, FALSE, DBusRealString::len, DBusRealString::str, and TRUE.

Referenced by _dbus_string_append_printf(), dbus_message_new_error_printf(), and dbus_set_error().

dbus_bool_t _dbus_string_append_uint ( DBusString str,
unsigned long  value 
)

Appends an unsigned integer to a DBusString.

Parameters:
str the string
value the integer value
Returns:
FALSE if not enough memory or other failure.

Definition at line 437 of file dbus-sysdeps.c.

References _dbus_string_get_data_len(), _dbus_string_lengthen(), _dbus_string_shorten(), FALSE, and TRUE.

Referenced by _dbus_append_user_from_current_process().

void _dbus_string_chop_white ( DBusString str  ) 

Deletes leading and trailing whitespace.

Parameters:
str the string

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

References _dbus_string_delete(), _dbus_string_set_length(), _dbus_string_skip_white(), and _dbus_string_skip_white_reverse().

Referenced by _dbus_split_paths_and_append().

dbus_bool_t _dbus_string_compact ( DBusString str,
int  max_waste 
)

Compacts the string to avoid wasted memory.

Wasted memory is memory that is allocated but not actually required to store the current length of the string. The compact is only done if more than the given amount of memory is being wasted (otherwise the waste is ignored and the call does nothing).

Parameters:
str the string
max_waste the maximum amount of waste to ignore
Returns:
FALSE if the compact failed due to realloc failure

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

References DBUS_STRING_PREAMBLE.

dbus_bool_t _dbus_string_copy ( const DBusString source,
int  start,
DBusString dest,
int  insert_at 
)

Like _dbus_string_move(), but does not delete the section of the source string that's copied to the dest string.

Parameters:
source the source string
start where to start copying the source string
dest the destination string
insert_at where to place the copied part of source string
Returns:
FALSE if not enough memory

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

References DBUS_STRING_COPY_PREAMBLE.

Referenced by _dbus_append_keyring_directory_for_credentials(), _dbus_auth_decode_data(), _dbus_auth_encode_data(), _dbus_auth_server_new(), _dbus_command_for_pid(), _dbus_concat_dir_and_file(), _dbus_header_copy(), _dbus_keyring_new_for_credentials(), _dbus_string_save_to_file(), dbus_message_copy(), and dbus_message_marshal().

dbus_bool_t _dbus_string_copy_data ( const DBusString str,
char **  data_return 
)

Copies the data from the string into a char*.

Parameters:
str the string
data_return place to return the data
Returns:
TRUE on success, FALSE on no memory

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

References _dbus_assert, DBUS_CONST_STRING_PREAMBLE, dbus_malloc(), FALSE, DBusRealString::len, NULL, DBusRealString::str, and TRUE.

Referenced by _dbus_split_paths_and_append(), _dbus_transport_init_base(), and dbus_server_get_id().

dbus_bool_t _dbus_string_copy_len ( const DBusString source,
int  start,
int  len,
DBusString dest,
int  insert_at 
)

Like _dbus_string_copy(), but can copy a segment from the middle of the source string.

Parameters:
source the source string
start where to start copying the source string
len length of segment to copy
dest the destination string
insert_at where to place the copied segment of source string
Returns:
FALSE if not enough memory

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

References _dbus_assert, and DBUS_STRING_COPY_PREAMBLE.

Referenced by _dbus_header_load(), _dbus_split_paths_and_append(), _dbus_string_get_dirname(), and dbus_parse_address().

void _dbus_string_copy_to_buffer ( const DBusString str,
char *  buffer,
int  avail_len 
)

Copies the contents of a DBusString into a different buffer.

It is a bug if avail_len is too short to hold the string contents. nul termination is not copied, just the supplied bytes.

Parameters:
str a string
buffer a C buffer to copy data to
avail_len maximum length of C buffer

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

References _dbus_assert, DBUS_CONST_STRING_PREAMBLE, DBusRealString::len, and DBusRealString::str.

Referenced by _dbus_generate_random_bytes_buffer().

void _dbus_string_copy_to_buffer_with_nul ( const DBusString str,
char *  buffer,
int  avail_len 
)

Copies the contents of a DBusString into a different buffer.

It is a bug if avail_len is too short to hold the string contents plus a nul byte.

Parameters:
str a string
buffer a C buffer to copy data to
avail_len maximum length of C buffer

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

References _dbus_assert, DBUS_CONST_STRING_PREAMBLE, DBusRealString::len, and DBusRealString::str.

void _dbus_string_delete ( DBusString str,
int  start,
int  len 
)

Deletes a segment of a DBusString with length len starting at start.

(Hint: to clear an entire string, setting length to 0 with _dbus_string_set_length() is easier.)

Parameters:
str the DBusString
start where to start deleting
len the number of bytes to delete

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

References _dbus_assert, and DBUS_STRING_PREAMBLE.

Referenced by _dbus_auth_bytes_sent(), _dbus_header_create(), _dbus_string_chop_white(), and _dbus_type_writer_write_reader_partial().

dbus_bool_t _dbus_string_ends_with_c_str ( const DBusString a,
const char *  c_str 
)

Returns whether a string ends with the given suffix.

Todo:
memcmp might make this faster.
Parameters:
a the string
c_str the C-style string
Returns:
TRUE if the string ends with the suffix

Definition at line 45 of file dbus-string-util.c.

References _dbus_assert, DBUS_GENERIC_STRING_PREAMBLE, FALSE, DBusRealString::len, NULL, DBusRealString::str, and TRUE.

dbus_bool_t _dbus_string_equal ( const DBusString a,
const DBusString b 
)

Tests two DBusString for equality.

Todo:
memcmp is probably faster
Parameters:
a first string
b second string
Returns:
TRUE if equal

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

References DBUS_GENERIC_STRING_PREAMBLE, FALSE, DBusRealString::len, DBusRealString::str, and TRUE.

Referenced by dbus_error_has_name().

dbus_bool_t _dbus_string_equal_c_str ( const DBusString a,
const char *  c_str 
)

Checks whether a string is equal to a C string.

Parameters:
a the string
c_str the C string
Returns:
TRUE if equal

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

References _dbus_assert, DBUS_GENERIC_STRING_PREAMBLE, FALSE, DBusRealString::len, NULL, DBusRealString::str, and TRUE.

Referenced by dbus_address_entry_get_value().

dbus_bool_t _dbus_string_equal_substring ( const DBusString a,
int  a_start,
int  a_len,
const DBusString b,
int  b_start 
)

Tests two sub-parts of two DBusString for equality.

The specified range of the first string must exist; the specified start position of the second string must exist.

Todo:
write a unit test
Todo:
memcmp is probably faster
Parameters:
a first string
a_start where to start substring in first string
a_len length of substring in first string
b second string
b_start where to start substring in second string
Returns:
TRUE if the two substrings are equal

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

References _dbus_assert, DBUS_GENERIC_STRING_PREAMBLE, FALSE, DBusRealString::len, DBusRealString::str, and TRUE.

dbus_bool_t _dbus_string_find ( const DBusString str,
int  start,
const char *  substr,
int *  found 
)

Finds the given substring in the string, returning TRUE and filling in the byte index where the substring was found, if it was found.

Returns FALSE if the substring wasn't found. Sets *start to the length of the string if the substring is not found.

Parameters:
str the string
start where to start looking
substr the substring
found return location for where it was found, or NULL
Returns:
TRUE if found

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

References _dbus_string_find_to().

Referenced by _dbus_keyring_validate_context(), _dbus_split_paths_and_append(), and dbus_parse_address().

dbus_bool_t _dbus_string_find_blank ( const DBusString str,
int  start,
int *  found 
)

Finds a blank (space or tab) in the string.

Returns TRUE if found, FALSE otherwise. If a blank is not found sets *found to the length of the string.

Parameters:
str the string
start byte index to start looking
found place to store the location of the first blank
Returns:
TRUE if a blank was found

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

References _dbus_assert, DBUS_CONST_STRING_PREAMBLE, FALSE, DBusRealString::len, DBusRealString::str, and TRUE.

Referenced by _dbus_keyring_validate_context().

dbus_bool_t _dbus_string_find_byte_backward ( const DBusString str,
int  start,
unsigned char  byte,
int *  found 
)

Find the given byte scanning backward from the given start.

Sets *found to -1 if the byte is not found.

Parameters:
str the string
start the place to start scanning (will not find the byte at this point)
byte the byte to find
found return location for where it was found
Returns:
TRUE if found

Definition at line 89 of file dbus-string-util.c.

References _dbus_assert, DBUS_CONST_STRING_PREAMBLE, and NULL.

Referenced by _dbus_string_get_dirname().

dbus_bool_t _dbus_string_find_eol ( const DBusString str,
int  start,
int *  found,
int *  found_len 
)

Finds end of line ("\r\n" or "\n") in the string, returning TRUE and filling in the byte index where the eol string was found, if it was found.

Returns FALSE if eol wasn't found.

Parameters:
str the string
start where to start looking
found return location for where eol was found or string length otherwise
found_len return length of found eol string or zero otherwise
Returns:
TRUE if found

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

References _dbus_assert, DBUS_CONST_STRING_PREAMBLE, FALSE, DBusRealString::len, DBusRealString::str, and TRUE.

Referenced by _dbus_string_pop_line().

dbus_bool_t _dbus_string_find_to ( const DBusString str,
int  start,
int  end,
const char *  substr,
int *  found 
)

Finds the given substring in the string, up to a certain position, returning TRUE and filling in the byte index where the substring was found, if it was found.

Returns FALSE if the substring wasn't found. Sets *start to the length of the string if the substring is not found.

Parameters:
str the string
start where to start looking
end where to stop looking
substr the substring
found return location for where it was found, or NULL
Returns:
TRUE if found

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

References _dbus_assert, DBUS_CONST_STRING_PREAMBLE, FALSE, NULL, DBusRealString::str, and TRUE.

Referenced by _dbus_string_find(), and dbus_parse_address().

void _dbus_string_free ( DBusString str  ) 

Frees a string created by _dbus_string_init().

Parameters:
str memory where the string is stored.

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

References DBusRealString::align_offset, DBusRealString::constant, dbus_free(), DBUS_GENERIC_STRING_PREAMBLE, DBusRealString::invalid, DBusRealString::str, and TRUE.

Referenced by _dbus_append_keyring_directory_for_credentials(), _dbus_auth_client_new(), _dbus_auth_server_new(), _dbus_auth_unref(), _dbus_command_for_pid(), _dbus_generate_random_bytes_buffer(), _dbus_get_autolaunch_address(), _dbus_get_standard_session_servicedirs(), _dbus_get_standard_system_servicedirs(), _dbus_header_copy(), _dbus_header_free(), _dbus_is_console_user(), _dbus_keyring_new_for_credentials(), _dbus_keyring_unref(), _dbus_message_loader_unref(), _dbus_server_finalize_base(), _dbus_server_init_base(), _dbus_server_listen_platform_specific(), _dbus_server_new_for_domain_socket(), _dbus_server_new_for_tcp_socket(), _dbus_sha_compute(), _dbus_split_paths_and_append(), _dbus_string_hex_decode(), _dbus_string_hex_encode(), _dbus_string_save_to_file(), _dbus_transport_new_for_domain_socket(), _dbus_transport_new_for_socket(), _dbus_transport_new_for_tcp_socket(), _dbus_user_at_console(), _dbus_write_pid_to_file_and_pipe(), dbus_address_escape_value(), dbus_address_unescape_value(), dbus_connection_dispatch(), dbus_get_local_machine_id(), dbus_message_copy(), dbus_message_iter_get_signature(), dbus_message_marshal(), dbus_message_new_error_printf(), dbus_parse_address(), dbus_set_error(), and dbus_signature_iter_get_signature().

char* _dbus_string_get_data_len ( DBusString str,
int  start,
int  len 
)

Gets a sub-portion of the raw character buffer from the string.

The "len" field is required simply for error checking, to be sure you don't try to use more string than exists. The nul termination of the returned buffer remains at the end of the entire string, not at start + len.

Parameters:
str the string
start byte offset to return
len length of segment to return
Returns:
the string data

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

References _dbus_assert, DBUS_STRING_PREAMBLE, and DBusRealString::str.

Referenced by _dbus_header_toggle_flag(), _dbus_marshal_byteswap(), _dbus_read(), _dbus_string_append_int(), and _dbus_string_append_uint().

dbus_bool_t _dbus_string_get_dirname ( const DBusString filename,
DBusString dirname 
)

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directory name from a complete filename.

Parameters:
filename the filename
dirname string to append directory name to
Returns:
FALSE if no memory

Definition at line 1090 of file dbus-sysdeps-util-unix.c.

References _dbus_assert, _dbus_string_append(), _dbus_string_copy_len(), _dbus_string_find_byte_backward(), and NULL.

dbus_bool_t _dbus_string_get_dirname ( const DBusStringfilename, DBusStringdirname  )

Get the directo