dbus/dbus dbus-marshal-recursive-util.c, 1.11, 1.12 dbus-marshal-recursive.c, 1.51, 1.52 dbus-marshal-recursive.h, 1.31, 1.32

John Palmieri johnp at kemper.freedesktop.org
Mon Sep 11 07:42:50 PDT 2006


Update of /cvs/dbus/dbus/dbus
In directory kemper:/tmp/cvs-serv30606/dbus

Modified Files:
	dbus-marshal-recursive-util.c dbus-marshal-recursive.c 
	dbus-marshal-recursive.h 
Log Message:
* dbus/dbus-marshal-recursive-util.c, dbus/dbus-marshal-recursive.c:
  remove DBusMark


Index: dbus-marshal-recursive-util.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-marshal-recursive-util.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- dbus-marshal-recursive-util.c	14 Aug 2006 19:11:35 -0000	1.11
+++ dbus-marshal-recursive-util.c	11 Sep 2006 14:42:48 -0000	1.12
@@ -983,23 +983,11 @@
                  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;
 }
 

Index: dbus-marshal-recursive.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-marshal-recursive.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- dbus-marshal-recursive.c	3 Aug 2006 20:34:36 -0000	1.51
+++ dbus-marshal-recursive.c	11 Sep 2006 14:42:48 -0000	1.52
@@ -119,8 +119,6 @@
   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 @@
     }
 }
 
-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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   FALSE,
   variant_reader_recurse,
   NULL,
-  base_reader_next,
-  NULL
+  base_reader_next
 };
 
 static const DBusTypeReaderClass const *
@@ -756,41 +734,6 @@
 }
 
 /**
- * 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 @@
 }
 
 /**
- * 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

Index: dbus-marshal-recursive.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-marshal-recursive.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- dbus-marshal-recursive.h	6 Sep 2006 00:14:06 -0000	1.31
+++ dbus-marshal-recursive.h	11 Sep 2006 14:42:48 -0000	1.32
@@ -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 @@
                                                          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);



More information about the dbus-commit mailing list