Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
b2cc52fa
Commit
b2cc52fa
authored
Sep 19, 2006
by
Nick Mathewson
🐻
Browse files
Speed up eat_whitespace by a lot.
svn:r8434
parent
6b716fdf
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
b2cc52fa
...
...
@@ -6,7 +6,7 @@ Changes in version 0.1.2.2-alpha - 2006-??-??
one.
o Minor Bugfixes
- Small performance improvements on parsing descriptors.
- Small performance improvements on parsing descriptors
(x2)
.
- Major performance descriptor on inserting descriptors; change
algorithm from O(n^2) to O(n).
- Make the common memory allocation path faster on machines where
...
...
src/common/util.c
View file @
b2cc52fa
...
...
@@ -413,17 +413,23 @@ eat_whitespace(const char *s)
{
tor_assert
(
s
);
while
(
TOR_ISSPACE
(
*
s
)
||
*
s
==
'#'
)
{
while
(
TOR_ISSPACE
(
*
s
))
s
++
;
if
(
*
s
==
'#'
)
{
/* read to a \n or \0 */
while
(
1
)
{
switch
(
*
s
)
{
case
'\0'
:
default:
return
s
;
case
' '
:
case
'\t'
:
case
'\n'
:
case
'\r'
:
++
s
;
break
;
case
'#'
:
++
s
;
while
(
*
s
&&
*
s
!=
'\n'
)
s
++
;
if
(
!*
s
)
return
s
;
++
s
;
}
}
return
s
;
}
/** Return a pointer to the first char of s that is not a space or a tab,
...
...
Write
Preview
Supports
Markdown
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