#include #include "spho/ctx.h" #include "spho/bind.h" struct spho_bind * spho_bind_create(struct spho_ctx *ctx, struct spho_bind *parent) { struct spho_bind *bind; if ((bind = malloc(sizeof(*bind))) == NULL) { SPHO_ERR(ctx, SPHO_ERR_SYS); return (NULL); } STAILQ_INIT(&bind->head); bind->ctx = ctx; bind->parent = parent; return (bind); } int spho_bind_add(struct spho_bind *bind, struct spho_nom *nom, struct spho_tp *tp) { struct spho_binding *b; if ((b = malloc(sizeof(*b))) == NULL) { SPHO_ERR(bind->ctx, SPHO_ERR_SYS); return (-1); } b->nom = nom; b->tp = tp; STAILQ_INSERT_TAIL(&bind->head, b, entries); return (0); }