aboutsummaryrefslogtreecommitdiff
path: root/src/meta.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-11 12:13:09 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-05-11 12:13:09 +0300
commit590e208c40797206fd6a93651fc59e0b68eeb545 (patch)
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')
-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
@@ -51,32 +51,32 @@ find_expansion_word (const char *kw, size_t len,
char *
meta_expand_string (const char *string, struct metadef *def, void *data,
struct dictionary *dict, void *handle)
{
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;
case '-':
if (*++p)
p++;
@@ -89,22 +89,22 @@ meta_expand_string (const char *string, struct metadef *def, void *data,
if (dict)
{
char *newval;
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;
default:
if ((s = find_expansion_char (*p, def, data)) != NULL)
@@ -118,26 +118,26 @@ meta_expand_string (const char *string, struct metadef *def, void *data,
if (dict)
{
char *newval;
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;
}
void
meta_free (struct metadef *def)
{

Return to:

Send suggestions and report system problems to the System administrator.