summaryrefslogtreecommitdiffabout
path: root/src/meta.c
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-11 09:13:09 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-05-11 09:13:09 (GMT)
commit590e208c40797206fd6a93651fc59e0b68eeb545 (patch) (side-by-side diff)
treed7abd0ca33b3355b1a27760bf9850e445fafd607 /src/meta.c
parentdb81e378576dcc5510032c72060e48e562f208c9 (diff)
downloadwydawca-590e208c40797206fd6a93651fc59e0b68eeb545.tar.gz
wydawca-590e208c40797206fd6a93651fc59e0b68eeb545.tar.bz2
Remove obstack.
* src/txtacc.c: New file. * gnulib.modules: Remove obstack. * src/wydawca.h (txtacc_create, txtacc_free) (txtacc_free_string, txtacc_grow) (txtacc_finish): New functions. (txtacc_1grow): New macro.
Diffstat (limited to 'src/meta.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/meta.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/meta.c b/src/meta.c
index 30d3041..61dc334 100644
--- a/src/meta.c
+++ b/src/meta.c
@@ -54,26 +54,26 @@ meta_expand_string (const char *string, struct metadef *def, void *data,
{
const char *p, *s;
char *res;
- struct obstack stk;
+ struct txtacc *acc;
if (!string)
return NULL;
- obstack_init (&stk);
+ acc = txtacc_create ();
for (p = string; *p;)
{
char *e;
size_t len = strcspn (p, "$");
- obstack_grow (&stk, p, len);
+ txtacc_grow (acc, p, len);
p += len;
if (*p == '$')
{
switch (*++p)
{
case '$':
- obstack_grow (&stk, p, 1);
+ txtacc_grow (acc, p, 1);
p++;
break;
@@ -92,16 +92,16 @@ meta_expand_string (const char *string, struct metadef *def, void *data,
size_t len;
/* FIXME: Return value? */
dictionary_quote_string (dict, handle, s, &newval, &len);
- obstack_grow (&stk, newval, len);
+ txtacc_grow (acc, newval, len);
free (newval);
}
else
- obstack_grow (&stk, s, strlen (s));
+ txtacc_grow (acc, s, strlen (s));
p = e + 1;
}
else
{
- obstack_grow (&stk, p - 1, 2);
+ txtacc_grow (acc, p - 1, 2);
p++;
}
break;
@@ -121,20 +121,20 @@ meta_expand_string (const char *string, struct metadef *def, void *data,
size_t len;
/* FIXME: Return value? */
dictionary_quote_string (dict, handle, s, &newval, &len);
- obstack_grow (&stk, newval, len);
+ txtacc_grow (acc, newval, len);
free (newval);
}
else
- obstack_grow (&stk, s, len);
+ txtacc_grow (acc, s, len);
p++;
}
}
else
- obstack_grow (&stk, p, 1);
+ txtacc_grow (acc, p, 1);
}
- obstack_1grow (&stk, 0);
- res = xstrdup (obstack_finish (&stk));
- obstack_free (&stk, NULL);
+ txtacc_1grow (acc, 0);
+ res = xstrdup (txtacc_finish (acc));
+ txtacc_free (acc);
return res;
}

Return to:

Send suggestions and report system problems to the System administrator.