Lines Matching refs:sg

89   StringGroup *sg;    /* The object to be returned */  in _new_StringGroup()  local
100 sg = (StringGroup *) malloc(sizeof(StringGroup)); in _new_StringGroup()
101 if(!sg) { in _new_StringGroup()
110 sg->node_mem = NULL; in _new_StringGroup()
111 sg->head = NULL; in _new_StringGroup()
112 sg->block_size = segment_size; in _new_StringGroup()
116 sg->node_mem = _new_FreeList(sizeof(StringSegment), STR_SEG_BLK); in _new_StringGroup()
117 if(!sg->node_mem) in _new_StringGroup()
118 return _del_StringGroup(sg); in _new_StringGroup()
119 return sg; in _new_StringGroup()
130 StringGroup *_del_StringGroup(StringGroup *sg) in _del_StringGroup() argument
132 if(sg) { in _del_StringGroup()
137 for(node=sg->head; node; node=node->next) { in _del_StringGroup()
145 sg->node_mem = _del_FreeList(sg->node_mem, 1); in _del_StringGroup()
146 sg->head = NULL; /* Already deleted by deleting sg->node_mem */ in _del_StringGroup()
150 free(sg); in _del_StringGroup()
168 char *_sg_store_string(StringGroup *sg, const char *string, int remove_escapes) in _sg_store_string() argument
175 if(!sg || !string) in _sg_store_string()
181 copy = _sg_alloc_string(sg, len); in _sg_store_string()
228 char *_sg_alloc_string(StringGroup *sg, int length) in _sg_alloc_string() argument
235 if(length > sg->block_size || length < 0) in _sg_alloc_string()
242 for(node=sg->head; node && node->unused <= length; node=node->next) in _sg_alloc_string()
248 node = (StringSegment *) _new_FreeListNode(sg->node_mem); in _sg_alloc_string()
256 node->unused = sg->block_size; in _sg_alloc_string()
260 node->block = (char *) malloc(sg->block_size); in _sg_alloc_string()
266 node->next = sg->head; in _sg_alloc_string()
267 sg->head = node; in _sg_alloc_string()
272 copy = node->block + sg->block_size - node->unused; in _sg_alloc_string()
287 void _clr_StringGroup(StringGroup *sg) in _clr_StringGroup() argument
293 for(node=sg->head; node; node=node->next) in _clr_StringGroup()
294 node->unused = sg->block_size; in _clr_StringGroup()