version 1.61, 2016/01/08 00:50:45 |
version 1.62, 2017/03/11 15:43:04 |
Line 366 eqn_def_find(struct eqn_node *ep, const char *key, siz |
|
Line 366 eqn_def_find(struct eqn_node *ep, const char *key, siz |
|
static const char * |
static const char * |
eqn_next(struct eqn_node *ep, char quote, size_t *sz, int repl) |
eqn_next(struct eqn_node *ep, char quote, size_t *sz, int repl) |
{ |
{ |
|
static size_t last_len; |
|
static int lim; |
|
|
char *start, *next; |
char *start, *next; |
int q, diff, lim; |
int q, diff; |
size_t ssz, dummy; |
size_t ssz, dummy; |
struct eqn_def *def; |
struct eqn_def *def; |
|
|
if (NULL == sz) |
if (NULL == sz) |
sz = &dummy; |
sz = &dummy; |
|
|
lim = 0; |
if (ep->cur >= last_len) |
|
lim = 0; |
ep->rew = ep->cur; |
ep->rew = ep->cur; |
again: |
again: |
/* Prevent self-definitions. */ |
/* Prevent self-definitions. */ |
|
|
memmove(start + *sz + diff, start + *sz, |
memmove(start + *sz + diff, start + *sz, |
(strlen(start) - *sz) + 1); |
(strlen(start) - *sz) + 1); |
memcpy(start, def->val, def->valsz); |
memcpy(start, def->val, def->valsz); |
|
last_len = start - ep->data + def->valsz; |
lim++; |
lim++; |
goto again; |
goto again; |
} |
} |