Merge: doc: fixed some typos and other misc. corrections
[nit.git] / clib / nit_main.c
index 66533e8..9b20edb 100644 (file)
 #include <stdarg.h>
 #include "gc.h"
 
-#define PRINT_ERROR(...) ((void)fprintf(stderr, __VA_ARGS__))
+#ifdef ANDROID
+       #include <android/log.h>
+       #define PRINT_ERROR(...) ((void)__android_log_print(ANDROID_LOG_WARN, "nit", __VA_ARGS__))
+#else
+       #define PRINT_ERROR(...) ((void)fprintf(stderr, __VA_ARGS__))
+#endif
 
 bigint object_id_counter = 1000000;
 enum gc_option { large, gc_opt_malloc, boehm, nitgc } gc_option;
@@ -226,13 +231,12 @@ void nitni_global_ref_list_init() {
 void nitni_global_ref_add( struct nitni_ref *ref ) {
        if ( nitni_global_ref_list->head == NULL ) {
                nitni_global_ref_list->head = ref;
-               nitni_global_ref_list->tail = ref;
-
                ref->prev = NULL;
        } else {
                nitni_global_ref_list->tail->next = ref;
                ref->prev = nitni_global_ref_list->tail;
        }
+       nitni_global_ref_list->tail = ref;
 
        ref->next = NULL;
 }