6 /* If memory allocation fails, bail out */
7 void *safe_malloc(size_t size)
9 void *ptr = malloc(size);
10 if(!ptr) fatal_error("Out of memory in safe_malloc", 0);
14 vm_char *safe_strdup(const vm_char *str)
16 vm_char *ptr = STRDUP(str);
17 if(!ptr) fatal_error("Out of memory in safe_strdup", 0);
22 /* We don't use printf directly, because format directives are not portable.
23 Instead we define the common cases here. */
29 void print_string(const char *str)
35 void print_cell(cell x)
37 printf(CELL_FORMAT,x);
40 void print_cell_hex(cell x)
42 printf(CELL_HEX_FORMAT,x);
45 void print_cell_hex_pad(cell x)
47 printf(CELL_HEX_PAD_FORMAT,x);
50 void print_fixnum(fixnum x)
52 printf(FIXNUM_FORMAT,x);
58 if(scanf(CELL_HEX_FORMAT,&cell) < 0) exit(1);