Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
/* 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;
}
Exemplo n.º 3
0
/* 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;
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
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;
}