Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. /* main.c generated by valac 0.12.0, the Vala compiler
  2. * generated from main.vala, do not modify */
  3.  
  4.  
  5. #include <glib.h>
  6. #include <glib-object.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <gee.h>
  10.  
  11. #define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
  12. #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
  13.  
  14.  
  15.  
  16. gint compare (gint* a, gint* b);
  17. gint _vala_main (gchar** args, int args_length1);
  18. static gint* _int_dup (gint* self);
  19. static gint _compare_gcompare_func (gconstpointer a, gconstpointer b);
  20.  
  21.  
  22. gint compare (gint* a, gint* b) {
  23. gint result = 0;
  24. result = *(a - b);
  25. return result;
  26. }
  27.  
  28.  
  29. static gint* _int_dup (gint* self) {
  30. gint* dup;
  31. dup = g_new0 (gint, 1);
  32. memcpy (dup, self, sizeof (gint));
  33. return dup;
  34. }
  35.  
  36.  
  37. static gint _compare_gcompare_func (gconstpointer a, gconstpointer b) {
  38. gint result;
  39. result = compare (a, b);
  40. return result;
  41. }
  42.  
  43.  
  44. static gpointer _g_object_ref0 (gpointer self) {
  45. return self ? g_object_ref (self) : NULL;
  46. }
  47.  
  48.  
  49. gint _vala_main (gchar** args, int args_length1) {
  50. gint result = 0;
  51. GeeArrayList* _tmp0_ = NULL;
  52. GeeArrayList* arr;
  53. gint _tmp1_;
  54. gint _tmp2_;
  55. gint _tmp3_;
  56. _tmp0_ = gee_array_list_new (G_TYPE_INT, (GBoxedCopyFunc) _int_dup, g_free, NULL);
  57. arr = _tmp0_;
  58. _tmp1_ = 100;
  59. gee_abstract_collection_add ((GeeAbstractCollection*) arr, &_tmp1_);
  60. _tmp2_ = 1;
  61. gee_abstract_collection_add ((GeeAbstractCollection*) arr, &_tmp2_);
  62. _tmp3_ = 10;
  63. gee_abstract_collection_add ((GeeAbstractCollection*) arr, &_tmp3_);
  64. gee_list_sort ((GeeList*) arr, _compare_gcompare_func);
  65. {
  66. GeeArrayList* _tmp4_;
  67. GeeArrayList* _i_list;
  68. gint _tmp5_;
  69. gint _i_size;
  70. gint _i_index;
  71. _tmp4_ = _g_object_ref0 (arr);
  72. _i_list = _tmp4_;
  73. _tmp5_ = gee_collection_get_size ((GeeCollection*) _i_list);
  74. _i_size = _tmp5_;
  75. _i_index = -1;
  76. while (TRUE) {
  77. gpointer _tmp6_ = NULL;
  78. gint* _tmp7_;
  79. gint _tmp8_;
  80. gint i;
  81. _i_index = _i_index + 1;
  82. if (!(_i_index < _i_size)) {
  83. break;
  84. }
  85. _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) _i_list, _i_index);
  86. _tmp7_ = (gint*) _tmp6_;
  87. _tmp8_ = *_tmp7_;
  88. _g_free0 (_tmp7_);
  89. i = _tmp8_;
  90. g_debug ("main.vala:17: %d", i);
  91. }
  92. _g_object_unref0 (_i_list);
  93. }
  94. result = 0;
  95. _g_object_unref0 (arr);
  96. return result;
  97. }
  98.  
  99.  
  100. int main (int argc, char ** argv) {
  101. g_type_init ();
  102. return _vala_main (argv, argc);
  103. }
  104.  
  105. ____
  106.  
  107. $ valac main.vala --pkg gee-1.0 --save-temps
  108. /home/markus/_valatest/_valatest/main.c: In function ‘compare’:
  109. /home/markus/_valatest/_valatest/main.c:24:11: error: invalid type argument of unary ‘*’ (have ‘long int’)
  110. /home/markus/_valatest/_valatest/main.c: In function ‘_compare_gcompare_func’:
  111. /home/markus/_valatest/_valatest/main.c:39:2: warning: passing argument 1 of ‘compare’ discards qualifiers from pointer target type
  112. /home/markus/_valatest/_valatest/main.c:22:6: note: expected ‘gint *’ but argument is of type ‘gconstpointer’
  113. /home/markus/_valatest/_valatest/main.c:39:2: warning: passing argument 2 of ‘compare’ discards qualifiers from pointer target type
  114. /home/markus/_valatest/_valatest/main.c:22:6: note: expected ‘gint *’ but argument is of type ‘gconstpointer’
  115. error: cc exited with status 256
  116. Compilation failed: 1 error(s), 0 warning(s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement