mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Fixed up internal 'g_test*' names.
* refcount/signals.c: * refcount/objects.c: * refcount/objects2.c: * refcount/closures.c: * refcount/properties.c: * refcount/properties2.c: changed namespace prefix from g_test_* to my_test_* to not clash with newly introduced g_test* API in glib. svn path=/trunk/; revision=5875
This commit is contained in:
parent
f0187b0a1b
commit
78373b68b9
@ -36,14 +36,14 @@ typedef struct {
|
||||
void (*test_signal2) (GTest * test, gint an_int);
|
||||
} GTestClass;
|
||||
|
||||
#define G_TYPE_TEST (g_test_get_type ())
|
||||
#define G_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define G_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define G_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define G_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define G_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
#define G_TYPE_TEST (my_test_get_type ())
|
||||
#define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define MY_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define MY_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define MY_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define MY_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
|
||||
G_DEFINE_TYPE (GTest, g_test, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE (GTest, my_test, G_TYPE_OBJECT);
|
||||
|
||||
/* --- variables --- */
|
||||
static volatile gboolean stopping = FALSE;
|
||||
@ -58,7 +58,7 @@ static gboolean seen_thread2 = FALSE;
|
||||
|
||||
/* --- functions --- */
|
||||
static void
|
||||
g_test_init (GTest * test)
|
||||
my_test_init (GTest * test)
|
||||
{
|
||||
g_print ("init %p\n", test);
|
||||
|
||||
@ -73,12 +73,12 @@ enum {
|
||||
};
|
||||
|
||||
static void
|
||||
g_test_set_property (GObject *object,
|
||||
my_test_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GTest *test = G_TEST (object);
|
||||
GTest *test = MY_TEST (object);
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_TEST_PROP:
|
||||
@ -91,12 +91,12 @@ g_test_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_get_property (GObject *object,
|
||||
my_test_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GTest *test = G_TEST (object);
|
||||
GTest *test = MY_TEST (object);
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_TEST_PROP:
|
||||
@ -109,32 +109,32 @@ g_test_get_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_test_signal2 (GTest *test,
|
||||
gint an_int)
|
||||
my_test_test_signal2 (GTest *test,
|
||||
gint an_int)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_emit_test_signal1 (GTest *test,
|
||||
gint vint)
|
||||
my_test_emit_test_signal1 (GTest *test,
|
||||
gint vint)
|
||||
{
|
||||
g_signal_emit (G_OBJECT (test), test_signal1, 0, vint);
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_emit_test_signal2 (GTest *test,
|
||||
gint vint)
|
||||
my_test_emit_test_signal2 (GTest *test,
|
||||
gint vint)
|
||||
{
|
||||
g_signal_emit (G_OBJECT (test), test_signal2, 0, vint);
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_class_init (GTestClass *klass)
|
||||
my_test_class_init (GTestClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = g_test_set_property;
|
||||
gobject_class->get_property = g_test_get_property;
|
||||
gobject_class->set_property = my_test_set_property;
|
||||
gobject_class->get_property = my_test_get_property;
|
||||
|
||||
test_signal1 = g_signal_new ("test-signal1", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GTestClass, test_signal1), NULL, NULL,
|
||||
@ -146,7 +146,7 @@ g_test_class_init (GTestClass *klass)
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TEST_PROP,
|
||||
g_param_spec_int ("test-prop", "Test Prop", "Test property",
|
||||
0, 1, 0, G_PARAM_READWRITE));
|
||||
klass->test_signal2 = g_test_test_signal2;
|
||||
klass->test_signal2 = my_test_test_signal2;
|
||||
}
|
||||
|
||||
static inline guint32
|
||||
@ -228,8 +228,8 @@ destroy_data (gpointer data,
|
||||
static void
|
||||
test_emissions (GTest *test)
|
||||
{
|
||||
g_test_emit_test_signal1 (test, TEST_INT1);
|
||||
g_test_emit_test_signal2 (test, TEST_INT2);
|
||||
my_test_emit_test_signal1 (test, TEST_INT1);
|
||||
my_test_emit_test_signal2 (test, TEST_INT2);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -2,12 +2,12 @@
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#define G_TYPE_TEST (g_test_get_type ())
|
||||
#define G_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define G_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define G_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define G_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define G_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
#define G_TYPE_TEST (my_test_get_type ())
|
||||
#define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define MY_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define MY_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define MY_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define MY_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
|
||||
typedef struct _GTest GTest;
|
||||
typedef struct _GTestClass GTestClass;
|
||||
@ -22,17 +22,17 @@ struct _GTestClass
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
static GType g_test_get_type (void);
|
||||
static GType my_test_get_type (void);
|
||||
static volatile gboolean stopping;
|
||||
|
||||
static void g_test_class_init (GTestClass * klass);
|
||||
static void g_test_init (GTest * test);
|
||||
static void g_test_dispose (GObject * object);
|
||||
static void my_test_class_init (GTestClass * klass);
|
||||
static void my_test_init (GTest * test);
|
||||
static void my_test_dispose (GObject * object);
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
static GType
|
||||
g_test_get_type (void)
|
||||
my_test_get_type (void)
|
||||
{
|
||||
static GType test_type = 0;
|
||||
|
||||
@ -41,12 +41,12 @@ g_test_get_type (void)
|
||||
sizeof (GTestClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc) g_test_class_init,
|
||||
(GClassInitFunc) my_test_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GTest),
|
||||
0,
|
||||
(GInstanceInitFunc) g_test_init,
|
||||
(GInstanceInitFunc) my_test_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -57,7 +57,7 @@ g_test_get_type (void)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_class_init (GTestClass * klass)
|
||||
my_test_class_init (GTestClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
@ -65,21 +65,21 @@ g_test_class_init (GTestClass * klass)
|
||||
|
||||
parent_class = g_type_class_ref (G_TYPE_OBJECT);
|
||||
|
||||
gobject_class->dispose = g_test_dispose;
|
||||
gobject_class->dispose = my_test_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_init (GTest * test)
|
||||
my_test_init (GTest * test)
|
||||
{
|
||||
g_print ("init %p\n", test);
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_dispose (GObject * object)
|
||||
my_test_dispose (GObject * object)
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
g_print ("dispose %p!\n", object);
|
||||
|
||||
@ -87,7 +87,7 @@ g_test_dispose (GObject * object)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_do_refcount (GTest * test)
|
||||
my_test_do_refcount (GTest * test)
|
||||
{
|
||||
g_object_ref (test);
|
||||
g_object_unref (test);
|
||||
@ -99,7 +99,7 @@ run_thread (GTest * test)
|
||||
gint i = 1;
|
||||
|
||||
while (!stopping) {
|
||||
g_test_do_refcount (test);
|
||||
my_test_do_refcount (test);
|
||||
if ((i++ % 10000) == 0) {
|
||||
g_print (".");
|
||||
g_thread_yield(); /* force context switch */
|
||||
|
@ -2,12 +2,12 @@
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#define G_TYPE_TEST (g_test_get_type ())
|
||||
#define G_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define G_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define G_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define G_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define G_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
#define G_TYPE_TEST (my_test_get_type ())
|
||||
#define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define MY_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define MY_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define MY_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define MY_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
|
||||
typedef struct _GTest GTest;
|
||||
typedef struct _GTestClass GTestClass;
|
||||
@ -22,16 +22,16 @@ struct _GTestClass
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
static GType g_test_get_type (void);
|
||||
static GType my_test_get_type (void);
|
||||
|
||||
static void g_test_class_init (GTestClass * klass);
|
||||
static void g_test_init (GTest * test);
|
||||
static void g_test_dispose (GObject * object);
|
||||
static void my_test_class_init (GTestClass * klass);
|
||||
static void my_test_init (GTest * test);
|
||||
static void my_test_dispose (GObject * object);
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
static GType
|
||||
g_test_get_type (void)
|
||||
my_test_get_type (void)
|
||||
{
|
||||
static GType test_type = 0;
|
||||
|
||||
@ -40,12 +40,12 @@ g_test_get_type (void)
|
||||
sizeof (GTestClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc) g_test_class_init,
|
||||
(GClassInitFunc) my_test_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GTest),
|
||||
0,
|
||||
(GInstanceInitFunc) g_test_init,
|
||||
(GInstanceInitFunc) my_test_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -56,7 +56,7 @@ g_test_get_type (void)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_class_init (GTestClass * klass)
|
||||
my_test_class_init (GTestClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
@ -64,21 +64,21 @@ g_test_class_init (GTestClass * klass)
|
||||
|
||||
parent_class = g_type_class_ref (G_TYPE_OBJECT);
|
||||
|
||||
gobject_class->dispose = g_test_dispose;
|
||||
gobject_class->dispose = my_test_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_init (GTest * test)
|
||||
my_test_init (GTest * test)
|
||||
{
|
||||
g_print ("init %p\n", test);
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_dispose (GObject * object)
|
||||
my_test_dispose (GObject * object)
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
g_print ("dispose %p!\n", object);
|
||||
|
||||
@ -86,7 +86,7 @@ g_test_dispose (GObject * object)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_do_refcount (GTest * test)
|
||||
my_test_do_refcount (GTest * test)
|
||||
{
|
||||
static guint i = 1;
|
||||
if (i++ % 100000 == 0)
|
||||
@ -109,7 +109,7 @@ main (int argc, char **argv)
|
||||
test = g_object_new (G_TYPE_TEST, NULL);
|
||||
|
||||
for (i=0; i<100000000; i++) {
|
||||
g_test_do_refcount (test);
|
||||
my_test_do_refcount (test);
|
||||
}
|
||||
|
||||
g_print ("\n");
|
||||
|
@ -2,12 +2,12 @@
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#define G_TYPE_TEST (g_test_get_type ())
|
||||
#define G_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define G_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define G_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define G_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define G_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
#define G_TYPE_TEST (my_test_get_type ())
|
||||
#define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define MY_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define MY_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define MY_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define MY_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@ -31,25 +31,25 @@ struct _GTestClass
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
static GType g_test_get_type (void);
|
||||
static GType my_test_get_type (void);
|
||||
static volatile gboolean stopping;
|
||||
|
||||
static void g_test_class_init (GTestClass * klass);
|
||||
static void g_test_init (GTest * test);
|
||||
static void g_test_dispose (GObject * object);
|
||||
static void g_test_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void g_test_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void my_test_class_init (GTestClass * klass);
|
||||
static void my_test_init (GTest * test);
|
||||
static void my_test_dispose (GObject * object);
|
||||
static void my_test_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void my_test_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
static GType
|
||||
g_test_get_type (void)
|
||||
my_test_get_type (void)
|
||||
{
|
||||
static GType test_type = 0;
|
||||
|
||||
@ -58,12 +58,12 @@ g_test_get_type (void)
|
||||
sizeof (GTestClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc) g_test_class_init,
|
||||
(GClassInitFunc) my_test_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GTest),
|
||||
0,
|
||||
(GInstanceInitFunc) g_test_init,
|
||||
(GInstanceInitFunc) my_test_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -73,7 +73,7 @@ g_test_get_type (void)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_class_init (GTestClass * klass)
|
||||
my_test_class_init (GTestClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
@ -81,9 +81,9 @@ g_test_class_init (GTestClass * klass)
|
||||
|
||||
parent_class = g_type_class_ref (G_TYPE_OBJECT);
|
||||
|
||||
gobject_class->dispose = g_test_dispose;
|
||||
gobject_class->get_property = g_test_get_property;
|
||||
gobject_class->set_property = g_test_set_property;
|
||||
gobject_class->dispose = my_test_dispose;
|
||||
gobject_class->get_property = my_test_get_property;
|
||||
gobject_class->set_property = my_test_set_property;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DUMMY,
|
||||
@ -95,31 +95,31 @@ g_test_class_init (GTestClass * klass)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_init (GTest * test)
|
||||
my_test_init (GTest * test)
|
||||
{
|
||||
static guint static_id = 1;
|
||||
test->id = static_id++;
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_dispose (GObject * object)
|
||||
my_test_dispose (GObject * object)
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
my_test_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -133,14 +133,14 @@ g_test_get_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
my_test_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -159,13 +159,13 @@ dummy_notify (GObject *object,
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
test->count++;
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_do_property (GTest * test)
|
||||
my_test_do_property (GTest * test)
|
||||
{
|
||||
gint dummy;
|
||||
|
||||
@ -179,7 +179,7 @@ run_thread (GTest * test)
|
||||
gint i = 1;
|
||||
|
||||
while (!stopping) {
|
||||
g_test_do_property (test);
|
||||
my_test_do_property (test);
|
||||
if ((i++ % 10000) == 0)
|
||||
{
|
||||
g_print (".%c", 'a' + test->id);
|
||||
|
@ -2,12 +2,12 @@
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#define G_TYPE_TEST (g_test_get_type ())
|
||||
#define G_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define G_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define G_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define G_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define G_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
#define G_TYPE_TEST (my_test_get_type ())
|
||||
#define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define MY_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define MY_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define MY_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define MY_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@ -29,24 +29,24 @@ struct _GTestClass
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
static GType g_test_get_type (void);
|
||||
static GType my_test_get_type (void);
|
||||
|
||||
static void g_test_class_init (GTestClass * klass);
|
||||
static void g_test_init (GTest * test);
|
||||
static void g_test_dispose (GObject * object);
|
||||
static void g_test_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void g_test_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void my_test_class_init (GTestClass * klass);
|
||||
static void my_test_init (GTest * test);
|
||||
static void my_test_dispose (GObject * object);
|
||||
static void my_test_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void my_test_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
static GType
|
||||
g_test_get_type (void)
|
||||
my_test_get_type (void)
|
||||
{
|
||||
static GType test_type = 0;
|
||||
|
||||
@ -55,12 +55,12 @@ g_test_get_type (void)
|
||||
sizeof (GTestClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc) g_test_class_init,
|
||||
(GClassInitFunc) my_test_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GTest),
|
||||
0,
|
||||
(GInstanceInitFunc) g_test_init,
|
||||
(GInstanceInitFunc) my_test_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -71,7 +71,7 @@ g_test_get_type (void)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_class_init (GTestClass * klass)
|
||||
my_test_class_init (GTestClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
@ -79,9 +79,9 @@ g_test_class_init (GTestClass * klass)
|
||||
|
||||
parent_class = g_type_class_ref (G_TYPE_OBJECT);
|
||||
|
||||
gobject_class->dispose = g_test_dispose;
|
||||
gobject_class->get_property = g_test_get_property;
|
||||
gobject_class->set_property = g_test_set_property;
|
||||
gobject_class->dispose = my_test_dispose;
|
||||
gobject_class->get_property = my_test_get_property;
|
||||
gobject_class->set_property = my_test_set_property;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DUMMY,
|
||||
@ -93,17 +93,17 @@ g_test_class_init (GTestClass * klass)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_init (GTest * test)
|
||||
my_test_init (GTest * test)
|
||||
{
|
||||
g_print ("init %p\n", test);
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_dispose (GObject * object)
|
||||
my_test_dispose (GObject * object)
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
g_print ("dispose %p!\n", object);
|
||||
|
||||
@ -111,14 +111,14 @@ g_test_dispose (GObject * object)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
my_test_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -132,14 +132,14 @@ g_test_get_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
my_test_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -164,7 +164,7 @@ dummy_notify (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_do_property (GTest * test)
|
||||
my_test_do_property (GTest * test)
|
||||
{
|
||||
gint dummy;
|
||||
|
||||
@ -190,7 +190,7 @@ main (int argc, char **argv)
|
||||
g_assert (count == test->dummy);
|
||||
|
||||
for (i=0; i<1000000; i++) {
|
||||
g_test_do_property (test);
|
||||
my_test_do_property (test);
|
||||
}
|
||||
|
||||
g_assert (count == test->dummy);
|
||||
|
@ -2,12 +2,12 @@
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#define G_TYPE_TEST (g_test_get_type ())
|
||||
#define G_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define G_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define G_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define G_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define G_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
#define G_TYPE_TEST (my_test_get_type ())
|
||||
#define MY_TEST(test) (G_TYPE_CHECK_INSTANCE_CAST ((test), G_TYPE_TEST, GTest))
|
||||
#define MY_IS_TEST(test) (G_TYPE_CHECK_INSTANCE_TYPE ((test), G_TYPE_TEST))
|
||||
#define MY_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_CAST ((tclass), G_TYPE_TEST, GTestClass))
|
||||
#define MY_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
|
||||
#define MY_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
|
||||
|
||||
static GRand *rand;
|
||||
|
||||
@ -29,7 +29,7 @@ struct _GTestClass
|
||||
void (*test_signal2) (GTest * test, gint an_int);
|
||||
};
|
||||
|
||||
static GType g_test_get_type (void);
|
||||
static GType my_test_get_type (void);
|
||||
static volatile gboolean stopping;
|
||||
|
||||
/* Element signals and args */
|
||||
@ -47,23 +47,23 @@ enum
|
||||
ARG_TEST_PROP
|
||||
};
|
||||
|
||||
static void g_test_class_init (GTestClass * klass);
|
||||
static void g_test_init (GTest * test);
|
||||
static void g_test_dispose (GObject * object);
|
||||
static void my_test_class_init (GTestClass * klass);
|
||||
static void my_test_init (GTest * test);
|
||||
static void my_test_dispose (GObject * object);
|
||||
|
||||
static void signal2_handler (GTest * test, gint anint);
|
||||
|
||||
static void g_test_set_property (GObject * object, guint prop_id,
|
||||
static void my_test_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
static void g_test_get_property (GObject * object, guint prop_id,
|
||||
static void my_test_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
static guint g_test_signals[LAST_SIGNAL] = { 0 };
|
||||
static guint my_test_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static GType
|
||||
g_test_get_type (void)
|
||||
my_test_get_type (void)
|
||||
{
|
||||
static GType test_type = 0;
|
||||
|
||||
@ -72,12 +72,12 @@ g_test_get_type (void)
|
||||
sizeof (GTestClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc) g_test_class_init,
|
||||
(GClassInitFunc) my_test_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GTest),
|
||||
0,
|
||||
(GInstanceInitFunc) g_test_init,
|
||||
(GInstanceInitFunc) my_test_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -90,7 +90,7 @@ g_test_get_type (void)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_class_init (GTestClass * klass)
|
||||
my_test_class_init (GTestClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
@ -101,15 +101,15 @@ g_test_class_init (GTestClass * klass)
|
||||
if (!g_thread_supported ())
|
||||
g_thread_init (NULL);
|
||||
|
||||
gobject_class->dispose = g_test_dispose;
|
||||
gobject_class->set_property = g_test_set_property;
|
||||
gobject_class->get_property = g_test_get_property;
|
||||
gobject_class->dispose = my_test_dispose;
|
||||
gobject_class->set_property = my_test_set_property;
|
||||
gobject_class->get_property = my_test_get_property;
|
||||
|
||||
g_test_signals[TEST_SIGNAL1] =
|
||||
my_test_signals[TEST_SIGNAL1] =
|
||||
g_signal_new ("test-signal1", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GTestClass, test_signal1), NULL,
|
||||
NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
g_test_signals[TEST_SIGNAL2] =
|
||||
my_test_signals[TEST_SIGNAL2] =
|
||||
g_signal_new ("test-signal2", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GTestClass, test_signal2), NULL,
|
||||
NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
@ -122,7 +122,7 @@ g_test_class_init (GTestClass * klass)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_init (GTest * test)
|
||||
my_test_init (GTest * test)
|
||||
{
|
||||
g_print ("init %p\n", test);
|
||||
|
||||
@ -130,11 +130,11 @@ g_test_init (GTest * test)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_dispose (GObject * object)
|
||||
my_test_dispose (GObject * object)
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
g_print ("dispose %p!\n", object);
|
||||
|
||||
@ -142,12 +142,12 @@ g_test_dispose (GObject * object)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
my_test_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_TEST_PROP:
|
||||
@ -160,12 +160,12 @@ g_test_set_property (GObject * object, guint prop_id,
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
my_test_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GTest *test;
|
||||
|
||||
test = G_TEST (object);
|
||||
test = MY_TEST (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_TEST_PROP:
|
||||
@ -178,9 +178,9 @@ g_test_get_property (GObject * object, guint prop_id,
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_do_signal1 (GTest * test)
|
||||
my_test_do_signal1 (GTest * test)
|
||||
{
|
||||
g_signal_emit (G_OBJECT (test), g_test_signals[TEST_SIGNAL1], 0, 0);
|
||||
g_signal_emit (G_OBJECT (test), my_test_signals[TEST_SIGNAL1], 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -189,13 +189,13 @@ signal2_handler (GTest * test, gint anint)
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_do_signal2 (GTest * test)
|
||||
my_test_do_signal2 (GTest * test)
|
||||
{
|
||||
g_signal_emit (G_OBJECT (test), g_test_signals[TEST_SIGNAL2], 0, 0);
|
||||
g_signal_emit (G_OBJECT (test), my_test_signals[TEST_SIGNAL2], 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
g_test_do_prop (GTest * test)
|
||||
my_test_do_prop (GTest * test)
|
||||
{
|
||||
test->value = g_rand_int (rand);
|
||||
g_object_notify (G_OBJECT (test), "test-prop");
|
||||
@ -208,11 +208,11 @@ run_thread (GTest * test)
|
||||
|
||||
while (!stopping) {
|
||||
if (TESTNUM == 1)
|
||||
g_test_do_signal1 (test);
|
||||
my_test_do_signal1 (test);
|
||||
if (TESTNUM == 2)
|
||||
g_test_do_signal2 (test);
|
||||
my_test_do_signal2 (test);
|
||||
if (TESTNUM == 3)
|
||||
g_test_do_prop (test);
|
||||
my_test_do_prop (test);
|
||||
if ((i++ % 10000) == 0) {
|
||||
g_print (".");
|
||||
g_thread_yield(); /* force context switch */
|
||||
|
Loading…
Reference in New Issue
Block a user