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
6482929b
Commit
6482929b
authored
Mar 30, 2011
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move build_varname above parse_section
parent
d7354d70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
26 deletions
+28
-26
src/config.c
+28
-26
No files found.
src/config.c
View file @
6482929b
...
...
@@ -497,6 +497,34 @@ static inline int config_keychar(int c)
return
isalnum
(
c
)
||
c
==
'-'
;
}
/*
* Returns $section.$name, using only name_len chars from the name,
* which is useful so we don't have to copy the variable name
* twice. The name of the variable is set to lowercase.
* Don't forget to free the buffer.
*/
static
char
*
build_varname
(
const
char
*
section
,
const
char
*
name
)
{
char
*
varname
;
int
section_len
,
ret
;
int
name_len
;
size_t
total_len
;
name_len
=
strlen
(
name
);
section_len
=
strlen
(
section
);
total_len
=
section_len
+
name_len
+
2
;
varname
=
malloc
(
total_len
);
if
(
varname
==
NULL
)
return
NULL
;
ret
=
snprintf
(
varname
,
total_len
,
"%s.%s"
,
section
,
name
);
if
(
ret
>=
0
){
strtolower
(
varname
+
section_len
+
1
);
}
return
varname
;
}
static
char
*
parse_section_header_ext
(
char
*
base_name
,
git_config
*
cfg
)
{
return
base_name
;
...
...
@@ -685,32 +713,6 @@ static int config_parse(git_config *cfg_file)
return
error
;
}
/*
* Returns $section.$name, using only name_len chars from the name,
* which is useful so we don't have to copy the variable name
* twice. The name of the variable is set to lowercase.
*Don't forget to free the buffer.
*/
static
char
*
build_varname
(
const
char
*
section
,
const
char
*
name
,
int
name_len
)
{
char
*
varname
;
int
section_len
,
ret
;
size_t
total_len
;
section_len
=
strlen
(
section
);
total_len
=
section_len
+
name_len
+
2
;
varname
=
malloc
(
total_len
);
if
(
varname
==
NULL
)
return
NULL
;
ret
=
snprintf
(
varname
,
total_len
,
"%s.%s"
,
section
,
name
);
if
(
ret
>=
0
){
strtolower
(
varname
+
section_len
+
1
);
}
return
varname
;
}
static
int
parse_variable
(
git_config
*
cfg
,
const
char
*
section_name
,
const
char
*
line
)
{
int
error
=
GIT_SUCCESS
;
...
...
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