diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-11 12:13:09 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-05-11 12:13:09 +0300 |
commit | 590e208c40797206fd6a93651fc59e0b68eeb545 (patch) | |
tree | d7abd0ca33b3355b1a27760bf9850e445fafd607 /src/cmdline.opt | |
parent | db81e378576dcc5510032c72060e48e562f208c9 (diff) | |
download | wydawca-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/cmdline.opt')
-rw-r--r-- | src/cmdline.opt | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/cmdline.opt b/src/cmdline.opt index 4c3d22f..afa1949 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt @@ -14,8 +14,7 @@ You should have received a copy of the GNU General Public License along with wydawca. If not, see <http://www.gnu.org/licenses/>. */ -static struct obstack pp_cmd_stack; -static int pp_cmd_stack_init; +static struct txtacc *pp_cmd_acc; static struct grecs_list *source_list; static struct grecs_list *tag_list; @@ -152,19 +151,16 @@ OPTION(define,D,SYMBOL[=VALUE], BEGIN char *p; - if (!pp_cmd_stack_init) - { - obstack_init (&pp_cmd_stack); - pp_cmd_stack_init = 1; - } - obstack_grow (&pp_cmd_stack, " \"-D", 4); + if (!pp_cmd_acc) + pp_cmd_acc = txtacc_create (); + txtacc_grow (pp_cmd_acc, " \"-D", 4); for (p = optarg; *p; p++) { if (*p == '\\' || *p == '"') - obstack_1grow (&pp_cmd_stack, '\\'); - obstack_1grow (&pp_cmd_stack, *p); + txtacc_1grow (pp_cmd_acc, '\\'); + txtacc_1grow (pp_cmd_acc, *p); } - obstack_1grow (&pp_cmd_stack, '"'); + txtacc_1grow (pp_cmd_acc, '"'); END OPTION(preprocessor,,COMMAND, @@ -213,13 +209,13 @@ void parse_options(int argc, char *argv[]) { GETOPT(argc, argv) - if (pp_cmd_stack_init && grecs_preprocessor) + if (pp_cmd_acc && grecs_preprocessor) { - char *defs = obstack_finish (&pp_cmd_stack); + char *defs = txtacc_finish (pp_cmd_acc); char *cmd = xmalloc (strlen (grecs_preprocessor) + strlen (defs) + 1); strcpy (cmd, grecs_preprocessor); strcat (cmd, defs); grecs_preprocessor = cmd; - obstack_free (&pp_cmd_stack, NULL); + txtacc_free (pp_cmd_acc); } } |