From bdc1bbdef526cbf08184d5688eeb7dc424ab750b Mon Sep 17 00:00:00 2001 From: Pavel Holejsovsky Date: Tue, 28 Sep 2010 07:48:50 +0200 Subject: Modify Regress impl so that inout args ignore (transfer) for 'in' direction. ... because for 'in' arguments only (transfer none) is correct. https://bugzilla.gnome.org/show_bug.cgi?id=630788 --- tests/scanner/regress.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests/scanner') diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index a6bac2b0..839114f8 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -379,7 +379,6 @@ regress_test_utf8_inout (char **inout) { /* inout parameter, transfer mode full */ g_assert (strcmp (*inout, utf8_const) == 0); - g_free(*inout); *inout = g_strdup (utf8_nonconst); } @@ -515,15 +514,16 @@ void regress_test_array_int_inout (int *n_ints, int **ints) { int i; + int *new_ints; - for (i = 1; i < *n_ints; i++) { - (*ints)[i-1] = (*ints)[i] + 1; - } - - if (0 < *n_ints) { - *n_ints -= 1; - } - *ints = g_realloc(*ints, sizeof(**ints) * *n_ints); + if (0 < *n_ints) + { + *n_ints -= 1; + new_ints = g_malloc(sizeof(**ints) * *n_ints); + for (i = 0; i < *n_ints; i++) + new_ints[i] = (*ints)[i + 1] + 1; + *ints = new_ints; + } } /** -- cgit v1.2.1