struct triple *new_triple(region r, int i, struct triple *prev) { struct triple *p = (struct triple *) rstralloc(r, sizeof(struct triple)); p->i = i; p->j = i; p->next = prev; return p; }
/* Make a new C string with a copy of cstring s */ char *cstring2str(region r, cstring s) { int len = s.length + 1; char *str = rstralloc(r, len); memcpy(str, s.data, len); return str; }
/* Make a new unintialised cstring of length l */ cstring alloc_cstring(region r, int l) { cstring cs; cs.data = rstralloc(r, l + 1); cs.data[l] = '\0'; cs.length = l; return cs; }
struct pair *new_pair(region r, int i, struct pair *prev) { struct pair *p = (struct pair *) rstralloc(r, sizeof(struct pair)); p->i = i; p->next = prev; return p; }
struct quint *new_quint(region r, int i, struct quint *prev) { struct quint *p = (struct quint *) rstralloc(r, sizeof(struct quint)); p->i = i; p->next = prev; return p; }