diff options
Diffstat (limited to 'tests/methods/bug723195.c-expected')
-rw-r--r-- | tests/methods/bug723195.c-expected | 283 |
1 files changed, 283 insertions, 0 deletions
diff --git a/tests/methods/bug723195.c-expected b/tests/methods/bug723195.c-expected new file mode 100644 index 000000000..4ba16552b --- /dev/null +++ b/tests/methods/bug723195.c-expected @@ -0,0 +1,283 @@ +/* methods_bug723195.c generated by valac, the Vala compiler + * generated from methods_bug723195.vala, do not modify */ + +#include <stdlib.h> +#include <string.h> +#include <glib.h> + +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); +#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } +#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } +#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +static void _vala_main (void); +static void _vala_array_destroy (gpointer array, + gssize array_length, + GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, + gssize array_length, + GDestroyNotify destroy_func); + +static gchar* +_vala_g_strjoinv (const gchar* separator, + gchar** str_array, + gint str_array_length1) +{ + gboolean _tmp0_ = FALSE; + gchar* result = NULL; + if (separator == NULL) { + separator = ""; + } + if (str_array != NULL) { + gboolean _tmp1_ = FALSE; + if (str_array_length1 > 0) { + _tmp1_ = TRUE; + } else { + gboolean _tmp2_ = FALSE; + if (str_array_length1 == -1) { + const gchar* _tmp3_; + _tmp3_ = str_array[0]; + _tmp2_ = _tmp3_ != NULL; + } else { + _tmp2_ = FALSE; + } + _tmp1_ = _tmp2_; + } + _tmp0_ = _tmp1_; + } else { + _tmp0_ = FALSE; + } + if (_tmp0_) { + gint i = 0; + gsize len = 0UL; + gint _tmp16_; + gint _tmp17_; + const gchar* res = NULL; + void* _tmp18_; + void* ptr = NULL; + const gchar* _tmp19_; + const gchar* _tmp20_; + void* _tmp21_; + const gchar* _tmp31_; + len = (gsize) 1; + { + gboolean _tmp4_ = FALSE; + i = 0; + _tmp4_ = TRUE; + while (TRUE) { + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gint _tmp10_ = 0; + const gchar* _tmp11_; + if (!_tmp4_) { + gint _tmp5_; + _tmp5_ = i; + i = _tmp5_ + 1; + } + _tmp4_ = FALSE; + if (str_array_length1 != -1) { + _tmp7_ = i < str_array_length1; + } else { + _tmp7_ = FALSE; + } + if (_tmp7_) { + _tmp6_ = TRUE; + } else { + gboolean _tmp8_ = FALSE; + if (str_array_length1 == -1) { + const gchar* _tmp9_; + _tmp9_ = str_array[i]; + _tmp8_ = _tmp9_ != NULL; + } else { + _tmp8_ = FALSE; + } + _tmp6_ = _tmp8_; + } + if (!_tmp6_) { + break; + } + _tmp11_ = str_array[i]; + if (_tmp11_ != NULL) { + const gchar* _tmp12_; + gint _tmp13_; + gint _tmp14_; + _tmp12_ = str_array[i]; + _tmp13_ = strlen ((const gchar*) _tmp12_); + _tmp14_ = _tmp13_; + _tmp10_ = _tmp14_; + } else { + _tmp10_ = 0; + } + len += (gsize) _tmp10_; + } + } + if (i == 0) { + gchar* _tmp15_; + _tmp15_ = g_strdup (""); + result = _tmp15_; + return result; + } + str_array_length1 = i; + _tmp16_ = strlen ((const gchar*) separator); + _tmp17_ = _tmp16_; + len += (gsize) (_tmp17_ * (i - 1)); + _tmp18_ = g_malloc (len); + res = _tmp18_; + _tmp19_ = res; + _tmp20_ = str_array[0]; + _tmp21_ = g_stpcpy ((void*) _tmp19_, (const gchar*) _tmp20_); + ptr = _tmp21_; + { + gboolean _tmp22_ = FALSE; + i = 1; + _tmp22_ = TRUE; + while (TRUE) { + void* _tmp24_; + void* _tmp25_; + const gchar* _tmp26_ = NULL; + const gchar* _tmp27_; + void* _tmp29_; + void* _tmp30_; + if (!_tmp22_) { + gint _tmp23_; + _tmp23_ = i; + i = _tmp23_ + 1; + } + _tmp22_ = FALSE; + if (!(i < str_array_length1)) { + break; + } + _tmp24_ = ptr; + _tmp25_ = g_stpcpy (_tmp24_, (const gchar*) separator); + ptr = _tmp25_; + _tmp27_ = str_array[i]; + if (_tmp27_ != NULL) { + const gchar* _tmp28_; + _tmp28_ = str_array[i]; + _tmp26_ = (const gchar*) _tmp28_; + } else { + _tmp26_ = ""; + } + _tmp29_ = ptr; + _tmp30_ = g_stpcpy (_tmp29_, _tmp26_); + ptr = _tmp30_; + } + } + _tmp31_ = res; + res = NULL; + result = (gchar*) _tmp31_; + return result; + } else { + gchar* _tmp32_; + _tmp32_ = g_strdup (""); + result = _tmp32_; + return result; + } +} + +static void +_vala_main (void) +{ + gchar** a = NULL; + gchar* _tmp0_; + gchar* _tmp1_; + gchar* _tmp2_; + gchar** _tmp3_; + gint a_length1; + gint _a_size_; + gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; + gchar* _tmp9_; + gchar* _tmp10_; + gchar* _tmp11_; + gchar* _tmp12_; + gchar* _tmp13_; + gchar* _tmp14_; + gchar* _tmp15_; + gchar* _tmp16_; + gchar* _tmp17_; + _tmp0_ = g_strdup ("foo"); + _tmp1_ = g_strdup ("bar"); + _tmp2_ = g_strdup ("baz"); + _tmp3_ = g_new0 (gchar*, 4 + 1); + _tmp3_[0] = _tmp0_; + _tmp3_[1] = _tmp1_; + _tmp3_[2] = NULL; + _tmp3_[3] = _tmp2_; + a = _tmp3_; + a_length1 = 4; + _a_size_ = a_length1; + a_length1 = 0; + _tmp4_ = _vala_g_strjoinv (":", a, (gint) a_length1); + _tmp5_ = _tmp4_; + _vala_assert (g_strcmp0 (_tmp5_, "") == 0, "string.joinv (\":\", a) == \"\""); + _g_free0 (_tmp5_); + a_length1 = 1; + _tmp6_ = _vala_g_strjoinv (":", a, (gint) a_length1); + _tmp7_ = _tmp6_; + _vala_assert (g_strcmp0 (_tmp7_, "foo") == 0, "string.joinv (\":\", a) == \"foo\""); + _g_free0 (_tmp7_); + a_length1 = 2; + _tmp8_ = _vala_g_strjoinv (":", a, (gint) a_length1); + _tmp9_ = _tmp8_; + _vala_assert (g_strcmp0 (_tmp9_, "foo:bar") == 0, "string.joinv (\":\", a) == \"foo:bar\""); + _g_free0 (_tmp9_); + a_length1 = 3; + _tmp10_ = _vala_g_strjoinv (":", a, (gint) a_length1); + _tmp11_ = _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "foo:bar:") == 0, "string.joinv (\":\", a) == \"foo:bar:\""); + _g_free0 (_tmp11_); + a_length1 = 4; + _tmp12_ = _vala_g_strjoinv (":", a, (gint) a_length1); + _tmp13_ = _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "foo:bar::baz") == 0, "string.joinv (\":\", a) == \"foo:bar::baz\""); + _g_free0 (_tmp13_); + a_length1 = -1; + _tmp14_ = _vala_g_strjoinv (":", a, (gint) a_length1); + _tmp15_ = _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "foo:bar") == 0, "string.joinv (\":\", a) == \"foo:bar\""); + _g_free0 (_tmp15_); + _tmp16_ = _vala_g_strjoinv (":", NULL, (gint) 0); + _tmp17_ = _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "") == 0, "string.joinv (\":\", null) == \"\""); + _g_free0 (_tmp17_); + a_length1 = 4; + a = (_vala_array_free (a, a_length1, (GDestroyNotify) g_free), NULL); +} + +int +main (int argc, + char ** argv) +{ + _vala_main (); + return 0; +} + +static void +_vala_array_destroy (gpointer array, + gssize array_length, + GDestroyNotify destroy_func) +{ + if ((array != NULL) && (destroy_func != NULL)) { + gssize i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + +static void +_vala_array_free (gpointer array, + gssize array_length, + GDestroyNotify destroy_func) +{ + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + |