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
928e2e8d
Commit
928e2e8d
authored
Aug 17, 2023
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vte: Simplify format loop with strcspn()
parent
75cc8f6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
14 deletions
+10
-14
vte.c
lib/libvarnish/vte.c
+10
-14
No files found.
lib/libvarnish/vte.c
View file @
928e2e8d
...
...
@@ -254,28 +254,24 @@ VTE_format(struct vte *vte, VTE_format_f *func, void *priv)
AN
(
p
);
q
=
p
;
for
(
fno
=
fsz
=
0
;
*
p
!=
'\0'
;
p
++
)
{
if
(
fsz
==
0
&&
fno
==
0
&&
*
p
==
' '
)
{
p
=
strchr
(
p
,
'\n'
);
if
(
p
==
NULL
)
{
p
=
q
+
1
;
// trigger final flush
break
;
}
continue
;
}
fno
=
0
;
while
(
*
p
!=
0
)
{
if
(
fno
==
0
&&
*
p
==
' '
)
fsz
=
strcspn
(
p
,
"
\n
"
);
else
fsz
=
strcspn
(
p
,
"
\t\n
"
);
p
+=
fsz
;
if
(
*
p
==
'\t'
)
{
assert
(
vte
->
f_maxsz
[
fno
]
+
nsp
>
fsz
);
VTE_FORMAT
(
func
,
priv
,
"%.*s%*s"
,
(
int
)(
p
-
q
),
q
,
vte
->
f_maxsz
[
fno
]
+
nsp
-
fsz
,
""
);
fno
++
;
fsz
=
0
;
q
=
p
+
1
;
q
=
++
p
;
}
else
if
(
*
p
==
'\n'
)
{
fno
=
0
;
fsz
=
0
;
}
else
fsz
++
;
p
++
;
}
}
if
(
q
<
p
)
...
...
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