Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
7fe9889a
Commit
7fe9889a
authored
Oct 24, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize the compiled code by generating static const gethdr_s's
parent
d445e56a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
13 deletions
+26
-13
generate.py
lib/libvcl/generate.py
+4
-5
vcc_compile.h
lib/libvcl/vcc_compile.h
+0
-2
vcc_var.c
lib/libvcl/vcc_var.c
+22
-6
No files found.
lib/libvcl/generate.py
View file @
7fe9889a
...
...
@@ -838,9 +838,9 @@ for i in sp_variables:
if
len
(
i
[
2
])
==
0
:
fo
.
write
(
'
\t
NULL,
\t
/* No reads allowed */
\n
'
)
elif
typ
==
"HEADER"
:
fo
.
write
(
'
\t
"
VRT_MkGethdr(req,
HDR_'
)
fo
.
write
(
'
\t
"HDR_'
)
fo
.
write
(
i
[
0
]
.
split
(
"."
)[
0
]
.
upper
())
fo
.
write
(
'
,
",
\n
'
)
fo
.
write
(
'",
\n
'
)
else
:
fo
.
write
(
'
\t
"VRT_r_
%
s(req)",
\n
'
%
cnam
)
fh
.
write
(
ctyp
+
" VRT_r_
%
s(const
%
s);
\n
"
%
(
cnam
,
i
[
4
]))
...
...
@@ -849,9 +849,9 @@ for i in sp_variables:
if
len
(
i
[
3
])
==
0
:
fo
.
write
(
'
\t
NULL,
\t
/* No writes allowed */
\n
'
)
elif
typ
==
"HEADER"
:
fo
.
write
(
'
\t
"
VRT_SetHdr(req, VRT_MkGethdr(req,
HDR_'
)
fo
.
write
(
'
\t
"HDR_'
)
fo
.
write
(
i
[
0
]
.
split
(
"."
)[
0
]
.
upper
())
fo
.
write
(
'
,
",
\n
'
)
fo
.
write
(
'",
\n
'
)
else
:
fo
.
write
(
'
\t
"VRT_l_
%
s(req, ",
\n
'
%
cnam
)
fh
.
write
(
"void VRT_l_
%
s(
%
s, "
%
(
cnam
,
i
[
4
]))
...
...
@@ -861,7 +861,6 @@ for i in sp_variables:
fh
.
write
(
ctyp
+
", ...);
\n
"
)
restrict
(
fo
,
i
[
3
])
fo
.
write
(
'
\t
0,
\n
'
)
# XXX: shoule be NULL
fo
.
write
(
"
\t
},
\n
"
)
fo
.
write
(
"
\t
{ NULL }
\n
};
\n
"
)
...
...
lib/libvcl/vcc_compile.h
View file @
7fe9889a
...
...
@@ -205,8 +205,6 @@ struct var {
unsigned
r_methods
;
const
char
*
lname
;
unsigned
w_methods
;
const
char
*
http
;
const
char
*
hdr
;
};
struct
method
{
...
...
lib/libvcl/vcc_var.c
View file @
7fe9889a
...
...
@@ -33,6 +33,7 @@
#include <string.h>
#include "vcc_compile.h"
#include "vct.h"
/*--------------------------------------------------------------------*/
...
...
@@ -42,8 +43,10 @@ vcc_Var_Wildcard(struct vcc *tl, const struct token *t, const struct symbol *wc)
struct
symbol
*
sym
;
struct
var
*
v
;
const
struct
var
*
vh
;
int
l
;
int
l
,
i
;
char
c
;
char
buf
[
258
];
char
cnam
[
256
];
vh
=
wc
->
var
;
...
...
@@ -55,14 +58,27 @@ vcc_Var_Wildcard(struct vcc *tl, const struct token *t, const struct symbol *wc)
v
->
r_methods
=
vh
->
r_methods
;
v
->
w_methods
=
vh
->
w_methods
;
v
->
fmt
=
vh
->
fmt
;
v
->
http
=
vh
->
http
;
/* Create a C-name version of the header name */
l
=
strlen
(
v
->
name
+
vh
->
len
)
+
1
;
for
(
i
=
0
;
i
<
l
-
1
;
i
++
)
{
c
=
*
(
v
->
name
+
vh
->
len
+
i
);
if
(
vct_isalpha
(
c
)
||
vct_isdigit
(
c
))
cnam
[
i
]
=
c
;
else
cnam
[
i
]
=
'_'
;
}
cnam
[
i
]
=
'\0'
;
/* Create the static identifier */
Fh
(
tl
,
0
,
"static const struct gethdr_s VGC_%s_%s =
\n
"
,
vh
->
rname
,
cnam
);
Fh
(
tl
,
0
,
" { %s,
\"\\
%03o%s:
\"
};
\n
"
,
vh
->
rname
,
(
unsigned
)
l
,
v
->
name
+
vh
->
len
);
bprintf
(
buf
,
"
\\
%03o%s:"
,
(
unsigned
)
l
,
v
->
name
+
vh
->
len
);
v
->
hdr
=
TlDup
(
tl
,
buf
);
bprintf
(
buf
,
"%s
\"
%s
\"
)"
,
vh
->
rname
,
v
->
hdr
);
bprintf
(
buf
,
"&VGC_%s_%s"
,
vh
->
rname
,
cnam
);
v
->
rname
=
TlDup
(
tl
,
buf
);
bprintf
(
buf
,
"
%s
\"
%s
\"
), "
,
vh
->
lname
,
v
->
hdr
);
bprintf
(
buf
,
"
VRT_SetHdr(req, %s, "
,
v
->
rname
);
v
->
lname
=
TlDup
(
tl
,
buf
);
sym
=
VCC_AddSymbolTok
(
tl
,
t
,
SYM_VAR
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment