/* * TRAIL utilities. The only notable thing here is that we keep our * own freelist instead of depending on malloc/free for that. */ #include #include "structs.h" #include "trail.h" static TRAIL *freelist = 0; TRAIL *newtrail(void) { TRAIL *t; t = freelist; if (t) { freelist = t->link; return(t); } return(malloc(sizeof(TRAIL))); } void freetrail(TRAIL *t) { t->link = freelist; freelist = t; } #if 0 void freetrail_all(TRAIL *t) { TRAIL *tt; if (t == 0) { return; } for (tt=t;tt->link;tt=tt->link) ; tt->link = freelist; freelist = t; } #endif