/* The initalization function of the IR. */
-void
+int
ir_init()
{
/* Init root cdat and stack */
char root[4] = "root";
- cdat_buf[num_cdats] = (struct cdat*) malloc(sizeof(struct cdat) );
+ if( (cdat_buf[num_cdats] = (struct cdat*) malloc(sizeof(struct cdat))) == NULL)
+ {
+ perror("malloc root class failed\n");
+ return -1;
+ }
cdat_buf[num_cdats]->idx = num_cdats;
memmove(cdat_buf[num_cdats]->name, root, 4);
cdat_stackp = cdat_stack;
*cdat_stackp++ = cdat_buf[num_cdats++];
+ return 0;
+
}
void