Home | History | Annotate | Download | only in libebl

Lines Matching refs:st

118 morememory (struct Ebl_GStrtab *st, size_t len)
128 newmem->next = st->memory;
129 st->memory = newmem;
130 st->backp = newmem->memory;
131 st->left = len - offsetof (struct memoryblock, memory);
136 ebl_gstrtabfree (struct Ebl_GStrtab *st)
138 struct memoryblock *mb = st->memory;
147 if (st->null.string != NULL)
148 free ((char *) st->null.string);
150 free (st);
155 newstring (struct Ebl_GStrtab *st, const char *str, size_t len)
159 - (((uintptr_t) st->backp)
164 if (st->left < align + sizeof (struct Ebl_GStrent) + len * st->width)
166 morememory (st, sizeof (struct Ebl_GStrent) + len * st->width);
171 struct Ebl_GStrent *newstr = (struct Ebl_GStrent *) (st->backp + align);
174 newstr->width = st->width;
180 for (int j = st->width - 1; j >= 0; --j)
181 newstr->reverse[i * st->width + j] = str[(len - 2 - i) * st->width + j];
182 for (size_t j = 0; j < st->width; ++j)
183 newstr->reverse[(len - 1) * st->width + j] = '\0';
184 st->backp += align + sizeof (struct Ebl_GStrent) + len * st->width;
185 st->left -= align + sizeof (struct Ebl_GStrent) + len * st->width;
221 ebl_gstrtabadd (struct Ebl_GStrtab *st, const char *str, size_t len)
232 for (j = 0; j < st->width; ++j)
233 if (str[len * st->width + j] != '\0')
235 while (j == st->width && ++len);
240 if (len == 1 && st->null.string != NULL)
241 return &st->null;
244 newstr = newstring (st, str, len);
249 sep = searchstring (&st->root, newstr);
263 st->left += (st->backp - (char *) newstr) * st->width;
264 st->backp = (char *) newstr;
271 st->backp -= newstr->len;
272 st->left += newstr->len;
282 st->total += newstr->len - (*sep)->len;
291 st->left += (st->backp - (char *) newstr) * st->width;
292 st->backp = (char *) newstr;
298 st->total += newstr->len;
330 ebl_gstrtabfinalize (struct Ebl_GStrtab *st, Elf_Data *data)
334 size_t nulllen = st->nullstr ? st->width : 0;
337 data->d_buf = malloc (st->total + nulllen);
343 if (st->nullstr)
344 memset (data->d_buf, '\0', st->width);
347 data->d_size = st->total + nulllen;
356 copystrings (st->root, &endp, &copylen);
357 assert (copylen == st->total * st->width + nulllen);