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
2f83bfce
Commit
2f83bfce
authored
Oct 09, 2014
by
Anurag Gupta (OSG)
Committed by
Carlos Martín Nieto
Oct 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git_filter: dup the filter name
parent
68fce7f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
src/filter.c
+11
-2
No files found.
src/filter.c
View file @
2f83bfce
...
@@ -38,7 +38,7 @@ struct git_filter_list {
...
@@ -38,7 +38,7 @@ struct git_filter_list {
};
};
typedef
struct
{
typedef
struct
{
c
onst
c
har
*
filter_name
;
char
*
filter_name
;
git_filter
*
filter
;
git_filter
*
filter
;
int
priority
;
int
priority
;
int
initialized
;
int
initialized
;
...
@@ -75,6 +75,7 @@ static void filter_registry_shutdown(void)
...
@@ -75,6 +75,7 @@ static void filter_registry_shutdown(void)
fdef
->
initialized
=
false
;
fdef
->
initialized
=
false
;
}
}
git__free
(
fdef
->
filter_name
);
git__free
(
fdef
->
attrdata
);
git__free
(
fdef
->
attrdata
);
git__free
(
fdef
);
git__free
(
fdef
);
}
}
...
@@ -230,6 +231,8 @@ int git_filter_register(
...
@@ -230,6 +231,8 @@ int git_filter_register(
size_t
nattr
=
0
,
nmatch
=
0
;
size_t
nattr
=
0
,
nmatch
=
0
;
git_buf
attrs
=
GIT_BUF_INIT
;
git_buf
attrs
=
GIT_BUF_INIT
;
assert
(
name
&&
filter
);
if
(
filter_registry_initialize
()
<
0
)
if
(
filter_registry_initialize
()
<
0
)
return
-
1
;
return
-
1
;
...
@@ -246,7 +249,9 @@ int git_filter_register(
...
@@ -246,7 +249,9 @@ int git_filter_register(
sizeof
(
git_filter_def
)
+
2
*
nattr
*
sizeof
(
char
*
),
1
);
sizeof
(
git_filter_def
)
+
2
*
nattr
*
sizeof
(
char
*
),
1
);
GITERR_CHECK_ALLOC
(
fdef
);
GITERR_CHECK_ALLOC
(
fdef
);
fdef
->
filter_name
=
name
;
fdef
->
filter_name
=
git__strdup
(
name
);
GITERR_CHECK_ALLOC
(
fdef
->
filter_name
);
fdef
->
filter
=
filter
;
fdef
->
filter
=
filter
;
fdef
->
priority
=
priority
;
fdef
->
priority
=
priority
;
fdef
->
nattrs
=
nattr
;
fdef
->
nattrs
=
nattr
;
...
@@ -256,6 +261,7 @@ int git_filter_register(
...
@@ -256,6 +261,7 @@ int git_filter_register(
filter_def_set_attrs
(
fdef
);
filter_def_set_attrs
(
fdef
);
if
(
git_vector_insert
(
&
git__filter_registry
->
filters
,
fdef
)
<
0
)
{
if
(
git_vector_insert
(
&
git__filter_registry
->
filters
,
fdef
)
<
0
)
{
git__free
(
fdef
->
filter_name
);
git__free
(
fdef
->
attrdata
);
git__free
(
fdef
->
attrdata
);
git__free
(
fdef
);
git__free
(
fdef
);
return
-
1
;
return
-
1
;
...
@@ -270,6 +276,8 @@ int git_filter_unregister(const char *name)
...
@@ -270,6 +276,8 @@ int git_filter_unregister(const char *name)
size_t
pos
;
size_t
pos
;
git_filter_def
*
fdef
;
git_filter_def
*
fdef
;
assert
(
name
);
/* cannot unregister default filters */
/* cannot unregister default filters */
if
(
!
strcmp
(
GIT_FILTER_CRLF
,
name
)
||
!
strcmp
(
GIT_FILTER_IDENT
,
name
))
{
if
(
!
strcmp
(
GIT_FILTER_CRLF
,
name
)
||
!
strcmp
(
GIT_FILTER_IDENT
,
name
))
{
giterr_set
(
GITERR_FILTER
,
"Cannot unregister filter '%s'"
,
name
);
giterr_set
(
GITERR_FILTER
,
"Cannot unregister filter '%s'"
,
name
);
...
@@ -288,6 +296,7 @@ int git_filter_unregister(const char *name)
...
@@ -288,6 +296,7 @@ int git_filter_unregister(const char *name)
fdef
->
initialized
=
false
;
fdef
->
initialized
=
false
;
}
}
git__free
(
fdef
->
filter_name
);
git__free
(
fdef
->
attrdata
);
git__free
(
fdef
->
attrdata
);
git__free
(
fdef
);
git__free
(
fdef
);
...
...
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