diff options
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | dbus/dbus-marshal-recursive-util.c | 12 | ||||
| -rw-r--r-- | dbus/dbus-marshal-recursive.c | 129 | ||||
| -rw-r--r-- | dbus/dbus-marshal-recursive.h | 31 | 
4 files changed, 14 insertions, 164 deletions
| @@ -1,3 +1,8 @@ +2006-09-08  John (J5) Palmieri  <johnp@redhat.com> + +	* dbus/dbus-marshal-recursive-util.c, dbus/dbus-marshal-recursive.c: +	remove DBusMark +  2006-09-10  Havoc Pennington  <hp@redhat.com>         patch mostly by Peter Kümmel, bug #8211 @@ -22,7 +27,6 @@  	instead of just a timeout (NULL) when the bus gets disconnected  	while blocking for a reply. -  2006-09-08  John (J5) Palmieri  <johnp@redhat.com>  	* dbus/dbus-connection.c (dbus_connection_dispatch): Properly remove diff --git a/dbus/dbus-marshal-recursive-util.c b/dbus/dbus-marshal-recursive-util.c index c2e9b411..e73edf49 100644 --- a/dbus/dbus-marshal-recursive-util.c +++ b/dbus/dbus-marshal-recursive-util.c @@ -983,23 +983,11 @@ node_read_value (TestTypeNode   *node,                   DBusTypeReader *reader,                   int             seed)  { -  DBusTypeMark mark;    DBusTypeReader restored; -  _dbus_type_reader_save_mark (reader, &mark); -    if (!(* node->klass->read_value) (node, reader, seed))      return FALSE; -  _dbus_type_reader_init_from_mark (&restored, -                                    reader->byte_order, -                                    reader->type_str, -                                    reader->value_str, -                                    &mark); - -  if (!(* node->klass->read_value) (node, &restored, seed)) -    return FALSE; -    return TRUE;  } diff --git a/dbus/dbus-marshal-recursive.c b/dbus/dbus-marshal-recursive.c index 8a8525f0..db71e863 100644 --- a/dbus/dbus-marshal-recursive.c +++ b/dbus/dbus-marshal-recursive.c @@ -119,8 +119,6 @@ struct DBusTypeReaderClass    dbus_bool_t (* check_finished)   (const DBusTypeReader  *reader); /**< check whether reader is at the end */    void        (* next)             (DBusTypeReader        *reader,                                      int                    current_type); /**< go to the next value */ -  void        (* init_from_mark)   (DBusTypeReader        *reader, -                                    const DBusTypeMark    *mark);  /**< uncompress from a mark */  };  static int @@ -620,24 +618,12 @@ array_reader_next (DBusTypeReader *reader,      }  } -static void -array_init_from_mark (DBusTypeReader     *reader, -                      const DBusTypeMark *mark) -{ -  /* Fill in the array-specific fields from the mark. The general -   * fields are already filled in. -   */ -  reader->u.array.start_pos = mark->array_start_pos; -  reader->array_len_offset = mark->array_len_offset; -} -  static const DBusTypeReaderClass body_reader_class = {    "body", 0,    FALSE,    NULL, /* body is always toplevel, so doesn't get recursed into */    NULL, -  base_reader_next, -  NULL +  base_reader_next  };  static const DBusTypeReaderClass body_types_only_reader_class = { @@ -645,8 +631,7 @@ static const DBusTypeReaderClass body_types_only_reader_class = {    TRUE,    NULL, /* body is always toplevel, so doesn't get recursed into */    NULL, -  base_reader_next, -  NULL +  base_reader_next  };  static const DBusTypeReaderClass struct_reader_class = { @@ -654,8 +639,7 @@ static const DBusTypeReaderClass struct_reader_class = {    FALSE,    struct_or_dict_entry_reader_recurse,    NULL, -  struct_reader_next, -  NULL +  struct_reader_next  };  static const DBusTypeReaderClass struct_types_only_reader_class = { @@ -663,8 +647,7 @@ static const DBusTypeReaderClass struct_types_only_reader_class = {    TRUE,    struct_or_dict_entry_types_only_reader_recurse,    NULL, -  struct_reader_next, -  NULL +  struct_reader_next  };  static const DBusTypeReaderClass dict_entry_reader_class = { @@ -672,8 +655,7 @@ static const DBusTypeReaderClass dict_entry_reader_class = {    FALSE,    struct_or_dict_entry_reader_recurse,    NULL, -  dict_entry_reader_next, -  NULL +  dict_entry_reader_next  };  static const DBusTypeReaderClass dict_entry_types_only_reader_class = { @@ -681,8 +663,7 @@ static const DBusTypeReaderClass dict_entry_types_only_reader_class = {    TRUE,    struct_or_dict_entry_types_only_reader_recurse,    NULL, -  dict_entry_reader_next, -  NULL +  dict_entry_reader_next  };  static const DBusTypeReaderClass array_reader_class = { @@ -690,8 +671,7 @@ static const DBusTypeReaderClass array_reader_class = {    FALSE,    array_reader_recurse,    array_reader_check_finished, -  array_reader_next, -  array_init_from_mark +  array_reader_next  };  static const DBusTypeReaderClass array_types_only_reader_class = { @@ -699,8 +679,7 @@ static const DBusTypeReaderClass array_types_only_reader_class = {    TRUE,    array_types_only_reader_recurse,    NULL, -  array_types_only_reader_next, -  NULL +  array_types_only_reader_next  };  static const DBusTypeReaderClass variant_reader_class = { @@ -708,8 +687,7 @@ static const DBusTypeReaderClass variant_reader_class = {    FALSE,    variant_reader_recurse,    NULL, -  base_reader_next, -  NULL +  base_reader_next  };  static const DBusTypeReaderClass const * @@ -756,41 +734,6 @@ _dbus_type_reader_init (DBusTypeReader    *reader,  }  /** - * Initializes a type reader that's been compressed into a - * DBusTypeMark.  The args have to be the same as those passed in to - * create the original #DBusTypeReader. - * - * @param reader the reader - * @param byte_order the byte order of the value block - * @param type_str string containing the type signature - * @param value_str string containing the values block - * @param mark the mark to decompress from - */ -void -_dbus_type_reader_init_from_mark (DBusTypeReader     *reader, -                                  int                 byte_order, -                                  const DBusString   *type_str, -                                  const DBusString   *value_str, -                                  const DBusTypeMark *mark) -{ -  reader->klass = all_reader_classes[mark->container_type]; - -  reader_init (reader, byte_order, -               mark->type_pos_in_value_str ? value_str : type_str, -               mark->type_pos, -               value_str, mark->value_pos); - -  if (reader->klass->init_from_mark) -    (* reader->klass->init_from_mark) (reader, mark); - -#if RECURSIVE_MARSHAL_READ_TRACE -  _dbus_verbose ("  type reader %p init from mark type_pos = %d value_pos = %d remaining sig '%s'\n", -                 reader, reader->type_pos, reader->value_pos, -                 _dbus_string_get_const_data_len (reader->type_str, reader->type_pos, 0)); -#endif -} - -/**   * Like _dbus_type_reader_init() but the iteration is over the   * signature, not over values.   * @@ -816,60 +759,6 @@ _dbus_type_reader_init_types_only (DBusTypeReader    *reader,  }  /** - * Like _dbus_type_reader_init_from_mark() but only iterates over - * the signature, not the values. - * - * @param reader the reader - * @param type_str the signature string - * @param mark the mark to decompress from - */ -void -_dbus_type_reader_init_types_only_from_mark (DBusTypeReader     *reader, -                                             const DBusString   *type_str, -                                             const DBusTypeMark *mark) -{ -  reader->klass = all_reader_classes[mark->container_type]; -  _dbus_assert (reader->klass->types_only); -  _dbus_assert (!mark->type_pos_in_value_str); - -  reader_init (reader, DBUS_COMPILER_BYTE_ORDER, /* irrelevant */ -               type_str, mark->type_pos, -               NULL, _DBUS_INT_MAX /* crashes if we screw up */); - -  if (reader->klass->init_from_mark) -    (* reader->klass->init_from_mark) (reader, mark); - -#if RECURSIVE_MARSHAL_READ_TRACE -  _dbus_verbose ("  type reader %p init types only from mark type_pos = %d remaining sig '%s'\n", -                 reader, reader->type_pos, -                 _dbus_string_get_const_data_len (reader->type_str, reader->type_pos, 0)); -#endif -} - -/** - * Compresses a type reader into a #DBusTypeMark, useful for example - * if you want to cache a bunch of positions in a block of values. - * - * @param reader the reader - * @param mark the mark to init - */ -void -_dbus_type_reader_save_mark (const DBusTypeReader *reader, -                             DBusTypeMark         *mark) -{ -  mark->type_pos_in_value_str = (reader->type_str == reader->value_str); -  mark->container_type = reader->klass->id; -  _dbus_assert (all_reader_classes[reader->klass->id] == reader->klass); - -  mark->type_pos = reader->type_pos; -  mark->value_pos = reader->value_pos; - -  /* these are just junk if the reader isn't really an array of course */ -  mark->array_len_offset = reader->array_len_offset; -  mark->array_start_pos = reader->u.array.start_pos; -} - -/**   * Gets the type of the value the reader is currently pointing to;   * or for a types-only reader gets the type it's currently pointing to.   * If the reader is at the end of a block or end of a container such diff --git a/dbus/dbus-marshal-recursive.h b/dbus/dbus-marshal-recursive.h index 686d162e..bc8a77f7 100644 --- a/dbus/dbus-marshal-recursive.h +++ b/dbus/dbus-marshal-recursive.h @@ -32,32 +32,11 @@  #error "config.h not included here"  #endif -typedef struct DBusTypeMark        DBusTypeMark;  typedef struct DBusTypeReader      DBusTypeReader;  typedef struct DBusTypeWriter      DBusTypeWriter;  typedef struct DBusTypeReaderClass DBusTypeReaderClass;  typedef struct DBusArrayLenFixup   DBusArrayLenFixup; -/** The mark is a way to compress a #DBusTypeReader; it isn't all that - * successful though. The idea was to use this for caching header - * fields in dbus-message.c. However now I'm thinking why not cache - * the actual values (e.g. char*) and if the field needs to be set or - * deleted, just linear search for it. Those operations are uncommon, - * and getting the values should be fast and not involve all this type - * reader nonsense. - * - * @todo 1.0 DBusTypeMark isn't used right now and probably won't be, we should delete it - */ -struct DBusTypeMark -{ -  dbus_uint32_t type_pos_in_value_str : 1; /**< true if the type_pos is in value_str and not type_str */ -  dbus_uint32_t container_type : 3; /**< the "id" of the container type */ -  dbus_uint32_t array_len_offset : 3; /**< bytes back from start_pos that len ends */ -  dbus_uint32_t type_pos : DBUS_MAXIMUM_MESSAGE_LENGTH_BITS; /**< position in type_str */ -  dbus_uint32_t value_pos : DBUS_MAXIMUM_MESSAGE_LENGTH_BITS; /**< position in value_str */ -  dbus_uint32_t array_start_pos : DBUS_MAXIMUM_MESSAGE_LENGTH_BITS; /**< start of the array the reader was iterating over */ -}; -  /**   * The type reader is an iterator for reading values from a block of   * values. @@ -128,19 +107,9 @@ void        _dbus_type_reader_init                      (DBusTypeReader        *                                                           int                    type_pos,                                                           const DBusString      *value_str,                                                           int                    value_pos); -void        _dbus_type_reader_init_from_mark            (DBusTypeReader        *reader, -                                                         int                    byte_order, -                                                         const DBusString      *type_str, -                                                         const DBusString      *value_str, -                                                         const DBusTypeMark    *mark);  void        _dbus_type_reader_init_types_only           (DBusTypeReader        *reader,                                                           const DBusString      *type_str,                                                           int                    type_pos); -void        _dbus_type_reader_init_types_only_from_mark (DBusTypeReader        *reader, -                                                         const DBusString      *type_str, -                                                         const DBusTypeMark    *mark); -void        _dbus_type_reader_save_mark                 (const DBusTypeReader  *reader, -                                                         DBusTypeMark          *mark);  int         _dbus_type_reader_get_current_type          (const DBusTypeReader  *reader);  int         _dbus_type_reader_get_element_type          (const DBusTypeReader  *reader);  int         _dbus_type_reader_get_value_pos             (const DBusTypeReader  *reader); | 
