Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
2f3ca807
Commit
2f3ca807
authored
8 years ago
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When parsing from memory, use counted buffers instead of strings.
parent
8fc3c521
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
configuration.c
configuration.c
+9
-9
No files found.
configuration.c
View file @
2f3ca807
...
...
@@ -923,25 +923,25 @@ parse_config_from_file(const char *filename, int *line_return)
return
rc
;
}
struct
string
_state
{
char
*
string
;
int
n
;
struct
buf
_state
{
char
*
buf
;
int
i
,
n
;
};
static
int
gnc_
string
(
struct
string
_state
*
s
)
gnc_
buf
(
struct
buf
_state
*
s
)
{
if
(
s
->
string
[
s
->
n
]
==
'\0'
)
return
-
1
;
if
(
s
->
i
<
s
->
n
)
return
s
->
buf
[
s
->
i
++
]
;
else
return
s
->
string
[
s
->
n
++
]
;
return
-
1
;
}
int
parse_config_from_string
(
char
*
string
)
{
struct
string_state
s
=
{
string
,
0
};
return
parse_config
((
gnc_t
)
gnc_
string
,
&
s
);
struct
buf_state
s
=
{
string
,
0
,
strlen
(
string
)
};
return
parse_config
((
gnc_t
)
gnc_
buf
,
&
s
);
}
static
void
...
...
This diff is collapsed.
Click to expand it.
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