Date:2012-06-03 07:00:56 (11 years 9 months ago)
Author:Werner Almesberger
Commit:c6e394436c7cd4a1ec9eff5f7d6818f51e115176
Message:b2/: move implicit initialization of FN, F1, ... to explicit function subex_init

Files: b2/boom.c (1 diff)
b2/subex.c (1 diff)
b2/subex.h (1 diff)

Change Details

b2/boom.c
136136    int i;
137137
138138    dollar = unique("$");
139    subex_init();
139140    for (i = 1; i != argc; i++) {
140141        if (*argv[i] != '-') {
141142            process(argv[i]);
b2/subex.c
235235int substitute(const struct subst *sub, const struct param *in,
236236    struct param **out)
237237{
238    int i;
239    char tmp[4];
240238    enum subst_type cause = 0;
241239
242    if (!fn) {
243        fn = unique("FN");
244        for (i = 0; i != FIELDS; i++) {
245            sprintf(tmp, "F%d", i);
246            f[i] = unique(tmp);
247        }
248    }
249240    *out = NULL;
250241    return recurse_sub(sub, in, NULL, NULL, NULL, NULL, out, &cause)
251242        != &jump_ignore;
252243}
244
245
246void subex_init(void)
247{
248    int i;
249    char tmp[4];
250
251    fn = unique("FN");
252    for (i = 0; i != FIELDS; i++) {
253        sprintf(tmp, "F%d", i);
254        f[i] = unique(tmp);
255    }
256}
b2/subex.h
2020int substitute(const struct subst *sub, const struct param *in,
2121    struct param **out);
2222
23void subex_init(void);
24
2325#endif /* !SUBEX_H */

Archive Download the corresponding diff file

Branches:
master



interactive