From 96d1b5d0efb045dd6f7cc42f6ea48f773d643fec Mon Sep 17 00:00:00 2001 From: Johan Bilien Date: Tue, 9 Dec 2008 15:27:47 +0000 Subject: [PATCH] =?utf8?q?Bug=20562545=20=E2=80=93=20Add=20function=20taki?= =?utf8?q?ng=20/=20returning=20GValue?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2008-12-09 Johan Bilien Bug 562545 – Add function taking / returning GValue * tests/everything/everything.[ch]: add a test of function taking and returning "const GValue *" svn path=/trunk/; revision=990 --- ChangeLog | 7 +++++++ tests/everything/everything.c | 31 +++++++++++++++++++++++++++++++ tests/everything/everything.h | 4 ++++ 3 files changed, 42 insertions(+) diff --git a/ChangeLog b/ChangeLog index ac7f810..b5c7d5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-12-09 Johan Bilien + + Bug 562545 – Add function taking / returning GValue + + * tests/everything/everything.[ch]: add a test of function taking and + returning "const GValue *" + 2008-12-09 Johan Dahlin * giscanner/cachestore.py (CacheStore.store): Use diff --git a/tests/everything/everything.c b/tests/everything/everything.c index c0bff6a..4c72692 100644 --- a/tests/everything/everything.c +++ b/tests/everything/everything.c @@ -142,6 +142,37 @@ int test_closure_one_arg (GClosure *closure, int arg) return ret; } +/** + * test_value_arg + * @v: (transfer none): a GValue expected to contain an int + * + * Return value: the int contained in the GValue. + */ +int test_int_value_arg(const GValue *v) { + int i; + + i = g_value_get_int (v); + + return i; +} + +static GValue value; +/** + * test_value_return: + * @i: an int + * + * Return value: (transfer none): the int wrapped in a GValue. + */ +const GValue *test_value_return(int i) { + memset(&value, '\0', sizeof(GValue)); + + g_value_init (&value, G_TYPE_INT); + g_value_set_int (&value, i); + + return &value; +} + + #if 0 /************************************************************************/ /* utf8 */ diff --git a/tests/everything/everything.h b/tests/everything/everything.h index 76f76fe..61a6b7d 100644 --- a/tests/everything/everything.h +++ b/tests/everything/everything.h @@ -70,6 +70,10 @@ void test_gslist_free (GSList *in); int test_closure (GClosure *closure); int test_closure_one_arg (GClosure *closure, int arg); +/* value */ +int test_int_value_arg(const GValue *v); +const GValue *test_value_return(int i); + /* enums / flags */ typedef enum -- 2.7.4