Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
9b737f6a
Commit
9b737f6a
authored
5 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
fix(config): Calculate value offset correctly
I need unit tests :/
parent
ffb1c4c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!375
Default main app selector
Pipeline
#4539
passed
5 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
epicardium/modules/config.c
+5
-4
5 additions, 4 deletions
epicardium/modules/config.c
with
5 additions
and
4 deletions
epicardium/modules/config.c
+
5
−
4
View file @
9b737f6a
...
...
@@ -146,7 +146,8 @@ static void trim(char *str)
// parses one line of the config file
static
void
parse_line
(
char
*
line
,
int
line_number
,
size_t
line_offset
)
{
char
*
line_start
=
line
;
char
*
line_start
=
line
;
char
*
value_start
=
strchr
(
line
,
'='
)
+
1
;
trim
(
line
);
...
...
@@ -190,7 +191,7 @@ static void parse_line(char *line, int line_number, size_t line_offset)
return
;
}
size_t
value_offset
=
value
-
line_start
+
line_offset
;
size_t
value_offset
=
value
_start
-
line_start
+
line_offset
;
add_config_pair
(
key
,
value
,
line_number
,
value_offset
);
}
...
...
@@ -617,7 +618,7 @@ int epic_config_set_string(const char *key, const char *value_in)
}
}
complex_out:
complex_out:
if
(
fd1
>=
0
)
{
epic_file_close
(
fd1
);
}
...
...
@@ -634,7 +635,7 @@ int epic_config_set_string(const char *key, const char *value_in)
}
}
out:
out:
/* Reload config so the new key or the changed value is available */
load_config
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment