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
4d588d97
Commit
4d588d97
authored
Aug 08, 2013
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't typedef a pointer
Make the iterator structure opaque and make sure it compiles.
parent
a603c191
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
12 deletions
+19
-12
include/git2/config.h
+1
-1
include/git2/sys/config.h
+1
-1
src/config.c
+2
-2
src/config.h
+5
-0
src/config_file.c
+10
-8
No files found.
include/git2/config.h
View file @
4d588d97
...
...
@@ -61,7 +61,7 @@ typedef struct {
}
git_config_entry
;
typedef
int
(
*
git_config_foreach_cb
)(
const
git_config_entry
*
,
void
*
);
typedef
struct
git_config_backend_iter
*
git_config_backend_iter
;
typedef
struct
git_config_backend_iter
git_config_backend_iter
;
typedef
enum
{
GIT_CVAR_FALSE
=
0
,
...
...
include/git2/sys/config.h
View file @
4d588d97
...
...
@@ -37,7 +37,7 @@ struct git_config_backend {
int
(
*
del
)(
struct
git_config_backend
*
,
const
char
*
key
);
int
(
*
iterator_new
)(
git_config_backend_iter
**
,
struct
git_config_backend
*
);
void
(
*
iterator_free
)(
git_config_backend_iter
*
);
int
(
*
next
)(
git_config_
backend_iter
*
,
git_config_entry
*
,
struct
git_config_backend
*
);
int
(
*
next
)(
git_config_
entry
*
,
git_config_backend_iter
*
);
int
(
*
refresh
)(
struct
git_config_backend
*
);
void
(
*
free
)(
struct
git_config_backend
*
);
};
...
...
src/config.c
View file @
4d588d97
...
...
@@ -328,7 +328,7 @@ int git_config_backend_foreach_match(
void
*
data
)
{
git_config_entry
entry
;
git_config_backend_iter
iter
;
git_config_backend_iter
*
iter
;
regex_t
regex
;
int
result
=
0
;
...
...
@@ -343,7 +343,7 @@ int git_config_backend_foreach_match(
if
(
backend
->
iterator_new
(
&
iter
,
backend
)
<
0
)
return
0
;
while
(
!
(
backend
->
next
(
&
iter
,
&
entry
,
backend
)
<
0
))
{
while
(
!
(
backend
->
next
(
&
entry
,
iter
)
<
0
))
{
/* skip non-matching keys if regexp was provided */
if
(
regexp
&&
regexec
(
&
regex
,
entry
.
name
,
0
,
NULL
,
0
)
!=
0
)
continue
;
...
...
src/config.h
View file @
4d588d97
...
...
@@ -24,6 +24,11 @@ struct git_config {
git_vector
files
;
};
typedef
struct
{
git_config_backend
*
backend
;
unsigned
int
flags
;
}
git_config_backend_iter
;
extern
int
git_config_find_global_r
(
git_buf
*
global_config_path
);
extern
int
git_config_find_xdg_r
(
git_buf
*
system_config_path
);
extern
int
git_config_find_system_r
(
git_buf
*
system_config_path
);
...
...
src/config_file.c
View file @
4d588d97
...
...
@@ -28,6 +28,8 @@ typedef struct cvar_t {
}
cvar_t
;
typedef
struct
git_config_file_iter
{
git_config_backend
*
backend
;
unsigned
int
flags
;
git_strmap_iter
iter
;
cvar_t
*
next
;
}
git_config_file_iter
;
...
...
@@ -254,7 +256,7 @@ static void backend_free(git_config_backend *_backend)
}
static
int
config_iterator_new
(
git_config_backend_iter
*
iter
,
git_config_backend_iter
*
*
iter
,
struct
git_config_backend
*
backend
)
{
diskfile_backend
*
b
=
(
diskfile_backend
*
)
backend
;
...
...
@@ -266,6 +268,7 @@ static int config_iterator_new(
*
it
=
git__calloc
(
1
,
sizeof
(
git_config_file_iter
));
GITERR_CHECK_ALLOC
(
it
);
(
*
it
)
->
backend
=
backend
;
(
*
it
)
->
iter
=
git_strmap_begin
(
b
->
values
);
(
*
it
)
->
next
=
NULL
;
...
...
@@ -273,18 +276,17 @@ static int config_iterator_new(
}
static
void
config_iterator_free
(
git_config_backend_iter
iter
)
git_config_backend_iter
*
iter
)
{
git__free
(
iter
);
}
static
int
config_next
(
git_config_backend_iter
*
iter
,
git_config_entry
*
entry
,
struct
git_config_backend
*
backend
)
static
int
config_iterator_next
(
git_config_entry
*
entry
,
git_config_backend_iter
*
iter
)
{
diskfile_backend
*
b
=
(
diskfile_backend
*
)
backend
;
git_config_file_iter
*
it
=
*
((
git_config_file_iter
**
)
iter
);
diskfile_backend
*
b
=
(
diskfile_backend
*
)
it
->
backend
;
int
err
;
cvar_t
*
var
;
const
char
*
key
;
...
...
@@ -611,7 +613,7 @@ int git_config_file__ondisk(git_config_backend **out, const char *path)
backend
->
parent
.
del
=
config_delete
;
backend
->
parent
.
iterator_new
=
config_iterator_new
;
backend
->
parent
.
iterator_free
=
config_iterator_free
;
backend
->
parent
.
next
=
config_next
;
backend
->
parent
.
next
=
config_
iterator_
next
;
backend
->
parent
.
refresh
=
config_refresh
;
backend
->
parent
.
free
=
backend_free
;
...
...
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