factor/vm/utilities.cpp

22 lines
333 B
C++
Raw Normal View History

2009-05-02 05:04:19 -04:00
#include "master.hpp"
2009-05-04 02:46:13 -04:00
namespace factor
{
2009-05-02 05:04:19 -04:00
/* If memory allocation fails, bail out */
vm_char *safe_strdup(const vm_char *str)
2009-05-02 05:04:19 -04:00
{
2009-05-04 05:50:24 -04:00
vm_char *ptr = STRDUP(str);
2009-05-02 05:04:19 -04:00
if(!ptr) fatal_error("Out of memory in safe_strdup", 0);
return ptr;
}
cell read_cell_hex()
2009-05-02 05:04:19 -04:00
{
2009-05-04 05:50:24 -04:00
cell cell;
2009-05-13 02:08:16 -04:00
if(scanf(CELL_HEX_FORMAT,&cell) < 0) exit(1);
2009-05-02 05:04:19 -04:00
return cell;
2009-08-17 16:37:09 -04:00
}
2009-05-04 02:46:13 -04:00
}