/* methods_bug723195.c generated by valac, the Vala compiler * generated from methods_bug723195.vala, do not modify */ #include #include #include #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; 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_; const gchar* _tmp19_ = NULL; const gchar* _tmp20_; void* ptr = NULL; const gchar* _tmp22_; void* _tmp23_; const gchar* _tmp33_; 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_; _tmp20_ = str_array[0]; if (_tmp20_ != NULL) { const gchar* _tmp21_; _tmp21_ = str_array[0]; _tmp19_ = (const gchar*) _tmp21_; } else { _tmp19_ = ""; } _tmp22_ = res; _tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_); ptr = _tmp23_; { gboolean _tmp24_ = FALSE; i = 1; _tmp24_ = TRUE; while (TRUE) { void* _tmp26_; void* _tmp27_; const gchar* _tmp28_ = NULL; const gchar* _tmp29_; void* _tmp31_; void* _tmp32_; if (!_tmp24_) { gint _tmp25_; _tmp25_ = i; i = _tmp25_ + 1; } _tmp24_ = FALSE; if (!(i < str_array_length1)) { break; } _tmp26_ = ptr; _tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator); ptr = _tmp27_; _tmp29_ = str_array[i]; if (_tmp29_ != NULL) { const gchar* _tmp30_; _tmp30_ = str_array[i]; _tmp28_ = (const gchar*) _tmp30_; } else { _tmp28_ = ""; } _tmp31_ = ptr; _tmp32_ = g_stpcpy (_tmp31_, _tmp28_); ptr = _tmp32_; } } _tmp33_ = res; res = NULL; result = (gchar*) _tmp33_; return result; } else { gchar* _tmp34_; _tmp34_ = g_strdup (""); result = _tmp34_; 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); }