Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
27da08ee
Commit
27da08ee
authored
Jul 14, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Add inline LogFragment ctor
parent
0a6877d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
14 deletions
+6
-14
src/shrpx_config.cc
src/shrpx_config.cc
+4
-14
src/shrpx_log.h
src/shrpx_log.h
+2
-0
No files found.
src/shrpx_config.cc
View file @
27da08ee
...
...
@@ -323,13 +323,6 @@ int parse_int(T *dest, const char *opt, const char *optarg) {
return
0
;
}
namespace
{
LogFragment
make_log_fragment
(
LogFragmentType
type
,
std
::
unique_ptr
<
char
[]
>
value
=
nullptr
)
{
return
LogFragment
{
type
,
std
::
move
(
value
)};
}
}
// namespace
namespace
{
bool
var_token
(
char
c
)
{
return
util
::
isAlpha
(
c
)
||
util
::
isDigit
(
c
)
||
c
==
'_'
;
...
...
@@ -418,19 +411,17 @@ std::vector<LogFragment> parse_log_format(const char *optarg) {
}
if
(
literal_start
<
var_start
)
{
res
.
push_back
(
make_log_fragment
(
SHRPX_LOGF_LITERAL
,
strcopy
(
literal_start
,
var_start
)));
res
.
emplace_back
(
SHRPX_LOGF_LITERAL
,
strcopy
(
literal_start
,
var_start
));
}
literal_start
=
p
;
if
(
value
==
nullptr
)
{
res
.
push_back
(
make_log_fragment
(
type
)
);
res
.
emplace_back
(
type
);
continue
;
}
res
.
push_back
(
make_log_fragment
(
type
,
strcopy
(
value
,
var_name
+
var_namelen
)));
res
.
emplace_back
(
type
,
strcopy
(
value
,
var_name
+
var_namelen
));
auto
&
v
=
res
.
back
().
value
;
for
(
size_t
i
=
0
;
v
[
i
];
++
i
)
{
if
(
v
[
i
]
==
'_'
)
{
...
...
@@ -440,8 +431,7 @@ std::vector<LogFragment> parse_log_format(const char *optarg) {
}
if
(
literal_start
!=
eop
)
{
res
.
push_back
(
make_log_fragment
(
SHRPX_LOGF_LITERAL
,
strcopy
(
literal_start
,
eop
)));
res
.
emplace_back
(
SHRPX_LOGF_LITERAL
,
strcopy
(
literal_start
,
eop
));
}
return
res
;
...
...
src/shrpx_log.h
View file @
27da08ee
...
...
@@ -123,6 +123,8 @@ enum LogFragmentType {
};
struct
LogFragment
{
LogFragment
(
LogFragmentType
type
,
std
::
unique_ptr
<
char
[]
>
value
=
nullptr
)
:
type
(
type
),
value
(
std
::
move
(
value
))
{}
LogFragmentType
type
;
std
::
unique_ptr
<
char
[]
>
value
;
};
...
...
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