comparison runtime/object.c @ 78:abc6f3d644a4

Use Boehm-GC for garbage collection. Also make no_impl print on stderr rather than standard in and return a non-zero error code.
author Mike Pavone <pavone@retrodev.com>
date Sun, 15 Jul 2012 18:11:00 -0700
parents 2a9c6eed0c70
children 75dc7161c1ca
comparison
equal deleted inserted replaced
77:8a9b96888b7d 78:abc6f3d644a4
1 #include "object.h" 1 #include "object.h"
2 #include <stdarg.h> 2 #include <stdarg.h>
3 #include <stdlib.h> 3 #include <stdlib.h>
4 #include <stddef.h> 4 #include <stddef.h>
5 #include <gc/gc.h>
5 6
6 object * make_object(obj_meta * meta, void * parent, int num_props, ...) 7 object * make_object(obj_meta * meta, void * parent, int num_props, ...)
7 { 8 {
8 va_list args; 9 va_list args;
9 object * newobj = malloc(meta->size); 10 object * newobj = GC_MALLOC(meta->size);
10 newobj->meta = meta; 11 newobj->meta = meta;
11 newobj->parent = parent; 12 newobj->parent = parent;
12 13
13 va_start(args, num_props); 14 va_start(args, num_props);
14 object ** curprop = ((object **)(newobj + 1)); 15 object ** curprop = ((object **)(newobj + 1));