[glib/gvariant-varargs] move serialiser/typeinfo to internal header
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/gvariant-varargs] move serialiser/typeinfo to internal header
- Date: Mon, 8 Mar 2010 15:22:30 +0000 (UTC)
commit 72a579ff1f698f6a9687538d543891c2bbe10aaf
Author: Ryan Lortie <desrt desrt ca>
Date: Mon Mar 8 10:21:50 2010 -0500
move serialiser/typeinfo to internal header
glib/glib.symbols | 29 +++++++++++++++++++++++++++++
glib/gvariant-internal.h | 3 +++
glib/gvariant-serialiser.c | 4 ++++
glib/gvariant-serialiser.h | 9 ---------
glib/gvarianttypeinfo.c | 11 ++++++++---
glib/gvarianttypeinfo.h | 10 +---------
glib/tests/gvariant.c | 40 +++++++++++++++++++---------------------
7 files changed, 64 insertions(+), 42 deletions(-)
---
diff --git a/glib/glib.symbols b/glib/glib.symbols
index b49a05d..9d0c2a1 100644
--- a/glib/glib.symbols
+++ b/glib/glib.symbols
@@ -1791,6 +1791,35 @@ g_variant_iter_loop
#endif
#endif
+#if IN_HEADER(__G_VARIANT_TYPE_INFO_H__)
+#if IN_FILE(__G_VARIANT_TYPE_INFO_C__)
+g_variant_type_info_get_type_string
+g_variant_type_info_query
+g_variant_type_info_element
+g_variant_type_info_query_element
+g_variant_type_info_n_members
+g_variant_type_info_member_info
+g_variant_type_info_get
+g_variant_type_info_ref
+g_variant_type_info_unref
+g_variant_type_info_assert_no_infos
+#endif
+#endif
+
+#if IN_HEADER(__G_VARIANT_SERIALISER_H__)
+#if IN_FILE(__G_VARIANT_SERIALISER_C__)
+g_variant_serialised_byteswap
+g_variant_serialised_get_child
+g_variant_serialised_is_normal
+g_variant_serialised_n_children
+g_variant_serialiser_is_object_path
+g_variant_serialiser_is_signature
+g_variant_serialiser_is_string
+g_variant_serialiser_needed_size
+g_variant_serialiser_serialise
+#endif
+#endif
+
#if IN_HEADER(__G_VARIANT_INTERNAL_H__)
#if IN_FILE(__G_VARIANT_C__)
g_variant_format_string_scan_type
diff --git a/glib/gvariant-internal.h b/glib/gvariant-internal.h
index 824ce26..66a080a 100644
--- a/glib/gvariant-internal.h
+++ b/glib/gvariant-internal.h
@@ -35,6 +35,9 @@
#include <glib/gvarianttype.h>
#include <glib/gtypes.h>
+#include "gvariant-serialiser.h"
+#include "gvarianttypeinfo.h"
+
gboolean g_variant_format_string_scan (const gchar *string,
const gchar *limit,
const gchar **endptr);
diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
index b10e618..a4c7fa6 100644
--- a/glib/gvariant-serialiser.c
+++ b/glib/gvariant-serialiser.c
@@ -1654,4 +1654,8 @@ g_variant_serialiser_is_signature (gconstpointer data,
return TRUE;
}
+/* Epilogue {{{1 */
+#define __G_VARIANT_SERIALISER_C__
+#include "galiasdef.c"
+
/* vim:set foldmethod=marker: */
diff --git a/glib/gvariant-serialiser.h b/glib/gvariant-serialiser.h
index d6a89b5..f26b118 100644
--- a/glib/gvariant-serialiser.h
+++ b/glib/gvariant-serialiser.h
@@ -33,9 +33,7 @@ typedef struct
} GVariantSerialised;
/* deserialisation */
-G_GNUC_INTERNAL
gsize g_variant_serialised_n_children (GVariantSerialised container);
-G_GNUC_INTERNAL
GVariantSerialised g_variant_serialised_get_child (GVariantSerialised container,
gsize index);
@@ -43,32 +41,25 @@ GVariantSerialised g_variant_serialised_get_child (GVarian
typedef void (*GVariantSerialisedFiller) (GVariantSerialised *serialised,
gpointer data);
-G_GNUC_INTERNAL
gsize g_variant_serialiser_needed_size (GVariantTypeInfo *info,
GVariantSerialisedFiller gsv_filler,
const gpointer *children,
gsize n_children);
-G_GNUC_INTERNAL
void g_variant_serialiser_serialise (GVariantSerialised container,
GVariantSerialisedFiller gsv_filler,
const gpointer *children,
gsize n_children);
/* misc */
-G_GNUC_INTERNAL
gboolean g_variant_serialised_is_normal (GVariantSerialised value);
-G_GNUC_INTERNAL
void g_variant_serialised_byteswap (GVariantSerialised value);
/* validation of strings */
-G_GNUC_INTERNAL
gboolean g_variant_serialiser_is_string (gconstpointer data,
gsize size);
-G_GNUC_INTERNAL
gboolean g_variant_serialiser_is_object_path (gconstpointer data,
gsize size);
-G_GNUC_INTERNAL
gboolean g_variant_serialiser_is_signature (gconstpointer data,
gsize size);
diff --git a/glib/gvarianttypeinfo.c b/glib/gvarianttypeinfo.c
index 00fafe9..f85db7e 100644
--- a/glib/gvarianttypeinfo.c
+++ b/glib/gvarianttypeinfo.c
@@ -861,6 +861,11 @@ g_variant_type_info_unref (GVariantTypeInfo *info)
}
}
-/* used from the test cases */
-#define assert_no_type_infos() \
- g_assert (g_variant_type_info_table == NULL)
+void
+g_variant_type_info_assert_no_infos (void)
+{
+ g_assert (g_variant_type_info_table == NULL);
+}
+
+#define __G_VARIANT_TYPE_INFO_C__
+#include "galiasdef.c"
diff --git a/glib/gvarianttypeinfo.h b/glib/gvarianttypeinfo.h
index 25a645b..7c7b544 100644
--- a/glib/gvarianttypeinfo.h
+++ b/glib/gvarianttypeinfo.h
@@ -125,35 +125,27 @@ typedef struct
#define G_VARIANT_MEMBER_ENDING_OFFSET 2
/* query */
-G_GNUC_INTERNAL
const gchar * g_variant_type_info_get_type_string (GVariantTypeInfo *typeinfo);
-G_GNUC_INTERNAL
void g_variant_type_info_query (GVariantTypeInfo *typeinfo,
guint *alignment,
gsize *size);
/* array */
-G_GNUC_INTERNAL
GVariantTypeInfo * g_variant_type_info_element (GVariantTypeInfo *typeinfo);
-G_GNUC_INTERNAL
void g_variant_type_info_query_element (GVariantTypeInfo *typeinfo,
guint *alignment,
gsize *size);
/* structure */
-G_GNUC_INTERNAL
gsize g_variant_type_info_n_members (GVariantTypeInfo *typeinfo);
-G_GNUC_INTERNAL
const GVariantMemberInfo * g_variant_type_info_member_info (GVariantTypeInfo *typeinfo,
gsize index);
/* new/ref/unref */
-G_GNUC_INTERNAL
GVariantTypeInfo * g_variant_type_info_get (const GVariantType *type);
-G_GNUC_INTERNAL
GVariantTypeInfo * g_variant_type_info_ref (GVariantTypeInfo *typeinfo);
-G_GNUC_INTERNAL
void g_variant_type_info_unref (GVariantTypeInfo *typeinfo);
+void g_variant_type_info_assert_no_infos (void);
#endif /* __G_VARIANT_TYPE_INFO_H__ */
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index be2f0f4..ec28e76 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -647,13 +647,6 @@ test_gvarianttype (void)
}
}
-#undef G_GNUC_INTERNAL
-#define G_GNUC_INTERNAL static
-
-#define DISABLE_VISIBILITY
-#define GLIB_COMPILATION
-#include <glib/gvarianttypeinfo.c>
-
#define ALIGNED(x, y) (((x + (y - 1)) / y) * y)
/* do our own calculation of the fixed_size and alignment of a type
@@ -1029,11 +1022,9 @@ test_gvarianttypeinfo (void)
g_free (desc);
}
- assert_no_type_infos ();
+ g_variant_type_info_assert_no_infos ();
}
-#include <glib/gvariant-serialiser.c>
-
#define MAX_FIXED_MULTIPLIER 256
#define MAX_INSTANCE_SIZE 1024
#define MAX_ARRAY_CHILDREN 128
@@ -1386,7 +1377,7 @@ test_maybes (void)
for (i = 0; i < 1000; i++)
test_maybe ();
- assert_no_type_infos ();
+ g_variant_type_info_assert_no_infos ();
}
static void
@@ -1525,7 +1516,7 @@ test_arrays (void)
for (i = 0; i < 100; i++)
test_array ();
- assert_no_type_infos ();
+ g_variant_type_info_assert_no_infos ();
}
static void
@@ -1685,7 +1676,7 @@ test_tuples (void)
for (i = 0; i < 100; i++)
test_tuple ();
- assert_no_type_infos ();
+ g_variant_type_info_assert_no_infos ();
}
static void
@@ -1758,7 +1749,7 @@ test_variants (void)
for (i = 0; i < 100; i++)
test_variant ();
- assert_no_type_infos ();
+ g_variant_type_info_assert_no_infos ();
}
static void
@@ -2186,7 +2177,7 @@ test_byteswaps (void)
for (i = 0; i < 200; i++)
test_byteswap ();
- assert_no_type_infos ();
+ g_variant_type_info_assert_no_infos ();
}
static void
@@ -2256,7 +2247,7 @@ test_fuzzes (gpointer data)
for (i = 0; i < 200; i++)
test_fuzz (&fuzziness);
- assert_no_type_infos ();
+ g_variant_type_info_assert_no_infos ();
}
static GVariant *
@@ -2472,11 +2463,8 @@ tree_instance_check_gvariant (TreeInstance *tree,
child = g_variant_get_variant (value);
str1 = g_variant_get_type_string (child);
str2 = g_variant_type_info_get_type_string (tree->children[0]->info);
-
- /* can't pointer-compare str1 and str2 since one comes from the
- * real GVariantTypeInfo and one comes from our private copy...
- */
- equal = strcmp (str1, str2) == 0 &&
+ /* GVariant only keeps one copy of type strings around */
+ equal = str1 == str2 &&
tree_instance_check_gvariant (tree->children[0], child);
g_variant_unref (child);
@@ -2680,6 +2668,8 @@ test_containers (void)
{
test_container ();
}
+
+ g_variant_type_info_assert_no_infos ();
}
static void
@@ -3247,6 +3237,8 @@ test_varargs (void)
g_variant_unref (value);
}
+
+ g_variant_type_info_assert_no_infos ();
}
static void
@@ -3306,6 +3298,8 @@ test_valist (void)
hash_get (value, "i#", &x);
g_assert (x == 234);
g_variant_unref (value);
+
+ g_variant_type_info_assert_no_infos ();
}
static void
@@ -3335,6 +3329,8 @@ test_builder_memory (void)
g_variant_builder_open (&sb, G_VARIANT_TYPE_ARRAY);
g_variant_builder_add (&sb, "s", "some value");
g_variant_builder_clear (&sb);
+
+ g_variant_type_info_assert_no_infos ();
}
static void
@@ -3380,6 +3376,8 @@ test_hashing (void)
}
g_hash_table_unref (table);
+
+ g_variant_type_info_assert_no_infos ();
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]