aboutsummaryrefslogtreecommitdiff
path: root/src/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/builtin.c')
-rw-r--r--src/builtin.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/builtin.c b/src/builtin.c
index 412a2e7..0a76738 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -146,13 +146,13 @@ parse_cmp_type (const char *pat, strcmp_fn *cmpfn, int *rf)
}
return 0;
}
struct builtin_data_storage
{
- struct obstack stk;
+ struct txtacc *acc;
char **wp;
};
static int default_ncol[] = {
4, /* project-uploader: name, realname, email, pubkey */
2, /* project-owner: email, realname */
@@ -161,25 +161,25 @@ static int default_ncol[] = {
int
builtin_lookup (struct dictionary *dict, void *handle, const char *req)
{
int i;
int rc;
size_t count = 0;
- struct obstack stk;
+ struct txtacc *acc;
int flags = 0;
strcmp_fn cmpfn = cmp_exact;
struct builtin_data_storage *bds;
int ncol = default_ncol[dict->id];
if (dict->parmc == 0)
{
dict->nrow = dict->ncol = 0;
return 0;
}
- obstack_init (&stk);
+ acc = txtacc_create ();
for (i = 0; i < dict->parmc; i++)
{
char *pat = dict->parmv[i];
if (pat[0] == '/')
@@ -195,39 +195,39 @@ builtin_lookup (struct dictionary *dict, void *handle, const char *req)
if (cmpfn (pat, req, flags))
{
size_t j;
for (j = 1; j <= ncol; j++)
{
char *val = dict->parmv[i + j];
- obstack_grow (&stk, val, strlen (val) + 1);
+ txtacc_grow (acc, val, strlen (val) + 1);
}
count++;
}
i += ncol;
}
dict->nrow = count;
dict->ncol = ncol;
if (count == 0)
{
- obstack_free (&stk, NULL);
+ txtacc_free (acc);
bds = NULL;
rc = 1;
}
else
{
size_t i;
char *p;
bds = xmalloc (sizeof (*bds));
count *= ncol;
bds->wp = xcalloc (count, sizeof (bds->wp[0]));
- bds->stk = stk;
- p = obstack_finish (&stk);
+ bds->acc = acc;
+ p = txtacc_finish (acc);
for (i = 0; i < count; i++)
{
bds->wp[i] = p;
p += strlen (p) + 1;
}
@@ -242,13 +242,13 @@ builtin_lookup (struct dictionary *dict, void *handle, const char *req)
int
builtin_free_result (struct dictionary *dict, void *handle)
{
if (dict->storage)
{
struct builtin_data_storage *bds = dict->storage;
- obstack_free (&bds->stk, NULL);
+ txtacc_free (bds->acc);
free (bds->wp);
free (bds);
dict->storage = NULL;
}
return 0;
}

Return to:

Send suggestions and report system problems to the System administrator.