1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
|
/* 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>
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#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);
}
|