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
8f624411
Commit
8f624411
authored
Nov 23, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Rewrite util::stripIter
parent
baf2dc3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
src/util.cc
src/util.cc
+1
-1
src/util.h
src/util.h
+5
-6
No files found.
src/util.cc
View file @
8f624411
...
...
@@ -33,7 +33,7 @@ namespace spdylay {
namespace
util
{
const
std
::
string
DEFAULT_STRIP_CHARSET
(
"
\r\n\t
"
)
;
const
char
DEFAULT_STRIP_CHARSET
[]
=
"
\r\n\t
"
;
bool
isAlpha
(
const
char
c
)
{
...
...
src/util.h
View file @
8f624411
...
...
@@ -27,6 +27,7 @@
#include "spdylay_config.h"
#include <cstring>
#include <vector>
#include <string>
#include <algorithm>
...
...
@@ -77,21 +78,19 @@ public:
}
};
extern
const
std
::
string
DEFAULT_STRIP_CHARSET
;
extern
const
char
DEFAULT_STRIP_CHARSET
[]
;
template
<
typename
InputIterator
>
std
::
pair
<
InputIterator
,
InputIterator
>
stripIter
(
InputIterator
first
,
InputIterator
last
,
const
std
::
string
&
chars
=
DEFAULT_STRIP_CHARSET
)
const
char
*
chars
=
DEFAULT_STRIP_CHARSET
)
{
for
(;
first
!=
last
&&
std
::
find
(
chars
.
begin
(),
chars
.
end
(),
*
first
)
!=
chars
.
end
();
++
first
);
for
(;
first
!=
last
&&
strchr
(
chars
,
*
first
)
!=
0
;
++
first
);
if
(
first
==
last
)
{
return
std
::
make_pair
(
first
,
last
);
}
InputIterator
left
=
last
-
1
;
for
(;
left
!=
first
&&
std
::
find
(
chars
.
begin
(),
chars
.
end
(),
*
left
)
!=
chars
.
end
();
--
left
);
for
(;
left
!=
first
&&
strchr
(
chars
,
*
left
)
!=
0
;
--
left
);
return
std
::
make_pair
(
first
,
left
+
1
);
}
...
...
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