Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
26faa366
Commit
26faa366
authored
Mar 29, 2011
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add build_varname to make a full var name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
parent
e15afc8e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
src/config.c
+17
-0
No files found.
src/config.c
View file @
26faa366
...
...
@@ -463,10 +463,25 @@ static int config_parse(git_config *cfg_file)
return
error
;
}
static
const
char
*
build_varname
(
const
char
*
section
,
const
char
*
name
,
int
len
)
{
static
char
varname
[
1024
];
/* TODO: What's the longest we should allow? */
if
(
strlen
(
section
)
+
len
+
2
>
sizeof
(
varname
))
return
NULL
;
strcpy
(
varname
,
section
);
strcat
(
varname
,
"."
);
strncat
(
varname
,
name
,
len
);
return
varname
;
}
static
int
parse_variable
(
git_config
*
cfg
,
const
char
*
section_name
,
const
char
*
line
)
{
int
error
;
int
has_value
=
1
;
const
char
*
varname
;
const
char
*
var_end
=
NULL
;
const
char
*
value_start
=
NULL
;
...
...
@@ -492,6 +507,8 @@ static int parse_variable(git_config *cfg, const char *section_name, const char
goto
error
;
}
varname
=
build_varname
(
section_name
,
line
,
var_end
-
line
+
1
);
return
GIT_SUCCESS
;
error:
...
...
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