Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
7e14355f
Commit
7e14355f
authored
Jun 18, 2019
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert std.toupper() and std.tolower() from STRING_LIST to STRANDS
parent
0cddee5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
26 deletions
+15
-26
vmod.vcc
lib/libvmod_std/vmod.vcc
+2
-2
vmod_std.c
lib/libvmod_std/vmod_std.c
+13
-24
No files found.
lib/libvmod_std/vmod.vcc
View file @
7e14355f
...
...
@@ -84,7 +84,7 @@ Example::
set req.url = std.querysort(req.url);
$Function STRING toupper(STR
ING_LIST
s)
$Function STRING toupper(STR
ANDS
s)
Converts the string *s* to uppercase.
...
...
@@ -92,7 +92,7 @@ Example::
set beresp.http.scream = std.toupper("yes!");
$Function STRING tolower(STR
ING_LIST
s)
$Function STRING tolower(STR
ANDS
s)
Converts the string *s* to lowercase.
...
...
lib/libvmod_std/vmod_std.c
View file @
7e14355f
...
...
@@ -65,26 +65,25 @@ vmod_set_ip_tos(VRT_CTX, VCL_INT tos)
}
static
const
char
*
vmod_updown
(
VRT_CTX
,
int
up
,
const
char
*
s
,
va_list
ap
)
vmod_updown
(
VRT_CTX
,
int
up
,
VCL_STRANDS
s
)
{
unsigned
u
;
char
*
b
,
*
e
;
const
char
*
p
;
int
i
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
u
=
WS_ReserveAll
(
ctx
->
ws
);
e
=
b
=
ctx
->
ws
->
f
;
e
+=
u
;
p
=
s
;
while
(
p
!=
vrt_magic_string_end
&&
b
<
e
)
{
if
(
p
!=
NULL
)
{
for
(;
b
<
e
&&
*
p
!=
'\0'
;
p
++
)
if
(
up
)
*
b
++
=
(
char
)
toupper
(
*
p
);
else
*
b
++
=
(
char
)
tolower
(
*
p
);
for
(
i
=
0
;
i
<
s
->
n
&&
b
<
e
;
i
++
)
{
p
=
s
->
p
[
i
];
while
(
p
!=
NULL
&&
*
p
!=
'\0'
&&
b
<
e
)
{
if
(
up
)
*
b
++
=
(
char
)
toupper
(
*
p
++
);
else
*
b
++
=
(
char
)
tolower
(
*
p
++
);
}
p
=
va_arg
(
ap
,
const
char
*
);
}
if
(
b
<
e
)
*
b
=
'\0'
;
...
...
@@ -102,29 +101,19 @@ vmod_updown(VRT_CTX, int up, const char *s, va_list ap)
}
VCL_STRING
v_matchproto_
(
td_std_toupper
)
vmod_toupper
(
VRT_CTX
,
const
char
*
s
,
...
)
vmod_toupper
(
VRT_CTX
,
VCL_STRANDS
s
)
{
const
char
*
p
;
va_list
ap
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
va_start
(
ap
,
s
);
p
=
vmod_updown
(
ctx
,
1
,
s
,
ap
);
va_end
(
ap
);
return
(
p
);
return
(
vmod_updown
(
ctx
,
1
,
s
));
}
VCL_STRING
v_matchproto_
(
td_std_tolower
)
vmod_tolower
(
VRT_CTX
,
const
char
*
s
,
...
)
vmod_tolower
(
VRT_CTX
,
VCL_STRANDS
s
)
{
const
char
*
p
;
va_list
ap
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
va_start
(
ap
,
s
);
p
=
vmod_updown
(
ctx
,
0
,
s
,
ap
);
va_end
(
ap
);
return
(
p
);
return
(
vmod_updown
(
ctx
,
0
,
s
));
}
VCL_REAL
v_matchproto_
(
td_std_random
)
...
...
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