chiark
/
gitweb
/
~mdw
/
disorder
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c582f1e
)
Further separation of template parsing and expansion
author
Richard Kettlewell
<rjk@greenend.org.uk>
Sun, 27 Apr 2008 21:26:15 +0000
(22:26 +0100)
committer
Richard Kettlewell
<rjk@greenend.org.uk>
Sun, 27 Apr 2008 21:26:15 +0000
(22:26 +0100)
server/cgi.c
patch
|
blob
|
blame
|
history
diff --git
a/server/cgi.c
b/server/cgi.c
index 47137172a21fedcfe2c23d95544b70027c188c9b..fd7290ea5ba0b571b04d80006e39ba9189e032eb 100644
(file)
--- a/
server/cgi.c
+++ b/
server/cgi.c
@@
-107,6
+107,12
@@
static struct kvp *labels;
static struct column *columns;
static void include_options(const char *name);
static struct column *columns;
static void include_options(const char *name);
+static void cgi_expand_parsed(const char *name,
+ struct cgi_element *head,
+ const struct cgi_expansion *expansions,
+ size_t nexpansions,
+ cgi_sink *output,
+ void *u);
static void cgi_parse_get(void) {
const char *q;
static void cgi_parse_get(void) {
const char *q;
@@
-502,6
+508,16
@@
void cgi_expand_string(const char *name,
size_t nexpansions,
cgi_sink *output,
void *u) {
size_t nexpansions,
cgi_sink *output,
void *u) {
+ cgi_expand_parsed(name, cgi_parse_string(name, template),
+ expansions, nexpansions, output, u);
+}
+
+static void cgi_expand_parsed(const char *name,
+ struct cgi_element *head,
+ const struct cgi_expansion *expansions,
+ size_t nexpansions,
+ cgi_sink *output,
+ void *u) {
int n, m;
char *argname;
struct dynstr d;
int n, m;
char *argname;
struct dynstr d;
@@
-510,7
+526,7
@@
void cgi_expand_string(const char *name,
struct cgi_element *e;
struct cgi_element *e;
- for(e =
cgi_parse_string(name, template)
; e; e = e->next) {
+ for(e =
head
; e; e = e->next) {
switch(e->type) {
case ELEMENT_TEXT:
output->sink->write(output->sink, e->text, strlen(e->text));
switch(e->type) {
case ELEMENT_TEXT:
output->sink->write(output->sink, e->text, strlen(e->text));