Lines Matching refs:sg

87   StringGroup *sg;    /* The object to be returned */  in _new_StringGroup()  local
98 sg = (StringGroup *) malloc(sizeof(StringGroup)); in _new_StringGroup()
99 if(!sg) { in _new_StringGroup()
108 sg->node_mem = NULL; in _new_StringGroup()
109 sg->head = NULL; in _new_StringGroup()
110 sg->block_size = segment_size; in _new_StringGroup()
114 sg->node_mem = _new_FreeList(sizeof(StringSegment), STR_SEG_BLK); in _new_StringGroup()
115 if(!sg->node_mem) in _new_StringGroup()
116 return _del_StringGroup(sg); in _new_StringGroup()
117 return sg; in _new_StringGroup()
128 StringGroup *_del_StringGroup(StringGroup *sg) in _del_StringGroup() argument
130 if(sg) { in _del_StringGroup()
135 for(node=sg->head; node; node=node->next) { in _del_StringGroup()
143 sg->node_mem = _del_FreeList(sg->node_mem, 1); in _del_StringGroup()
144 sg->head = NULL; /* Already deleted by deleting sg->node_mem */ in _del_StringGroup()
148 free(sg); in _del_StringGroup()
166 char *_sg_store_string(StringGroup *sg, const char *string, int remove_escapes) in _sg_store_string() argument
173 if(!sg || !string) in _sg_store_string()
179 copy = _sg_alloc_string(sg, len); in _sg_store_string()
226 char *_sg_alloc_string(StringGroup *sg, int length) in _sg_alloc_string() argument
233 if(length > sg->block_size || length < 0) in _sg_alloc_string()
240 for(node=sg->head; node && node->unused <= length; node=node->next) in _sg_alloc_string()
246 node = (StringSegment *) _new_FreeListNode(sg->node_mem); in _sg_alloc_string()
254 node->unused = sg->block_size; in _sg_alloc_string()
258 node->block = (char *) malloc(sg->block_size); in _sg_alloc_string()
264 node->next = sg->head; in _sg_alloc_string()
265 sg->head = node; in _sg_alloc_string()
270 copy = node->block + sg->block_size - node->unused; in _sg_alloc_string()
285 void _clr_StringGroup(StringGroup *sg) in _clr_StringGroup() argument
291 for(node=sg->head; node; node=node->next) in _clr_StringGroup()
292 node->unused = sg->block_size; in _clr_StringGroup()