Merge: doc: fixed some typos and other misc. corrections
[nit.git] / clib / gc_static_objects_list.c
1 /* This file is part of NIT ( http://www.nitlanguage.org ).
2 *
3 * Copyright 2009 Julien Chevalier <chevjulien@gmail.com>
4 *
5 * This file is free software, which comes along with NIT. This software is
6 * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8 * PARTICULAR PURPOSE. You can modify it is you want, provided this header
9 * is kept unaltered, and a notification of the changes is added.
10 * You are allowed to redistribute it and sell it, alone or is a part of
11 * another product.
12 */
13
14 #include "gc_static_objects_list.h"
15
16 void GC_List_Init(GC_List *list) {
17 list->top = NULL;
18 list->size = 0;
19 }
20
21 int GC_List_Push(GC_List *list, val_t *pointer) {
22 GC_static_object *newElement;
23 newElement = (GC_static_object*)malloc(sizeof(GC_static_object));
24 if (newElement == NULL)
25 return -1;
26
27 newElement->pointer = pointer;
28 newElement->next = list->top;
29 list->top = newElement;
30 list->size++;
31 return 0;
32 }
33