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
a37aa82e
Commit
a37aa82e
authored
May 13, 2014
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some coverity inspired cleanups
parent
03fcef18
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
18 deletions
+22
-18
src/config.c
+5
-5
src/config_file.c
+4
-2
src/diff_driver.c
+5
-5
src/tag.c
+8
-6
No files found.
src/config.c
View file @
a37aa82e
...
@@ -153,19 +153,19 @@ int git_config_snapshot(git_config **out, git_config *in)
...
@@ -153,19 +153,19 @@ int git_config_snapshot(git_config **out, git_config *in)
git_config_backend
*
b
;
git_config_backend
*
b
;
if
((
error
=
internal
->
file
->
snapshot
(
&
b
,
internal
->
file
))
<
0
)
if
((
error
=
internal
->
file
->
snapshot
(
&
b
,
internal
->
file
))
<
0
)
goto
on_error
;
break
;
if
((
error
=
git_config_add_backend
(
config
,
b
,
internal
->
level
,
0
))
<
0
)
{
if
((
error
=
git_config_add_backend
(
config
,
b
,
internal
->
level
,
0
))
<
0
)
{
b
->
free
(
b
);
b
->
free
(
b
);
goto
on_error
;
break
;
}
}
}
}
if
(
error
<
0
)
git_config_free
(
config
);
else
*
out
=
config
;
*
out
=
config
;
return
error
;
on_error:
git_config_free
(
config
);
return
error
;
return
error
;
}
}
...
...
src/config_file.c
View file @
a37aa82e
...
@@ -313,6 +313,7 @@ static int config__refresh(git_config_backend *cfg)
...
@@ -313,6 +313,7 @@ static int config__refresh(git_config_backend *cfg)
goto
out
;
goto
out
;
reader
=
git_array_get
(
b
->
readers
,
git_array_size
(
b
->
readers
)
-
1
);
reader
=
git_array_get
(
b
->
readers
,
git_array_size
(
b
->
readers
)
-
1
);
GITERR_CHECK_ALLOC
(
reader
);
if
((
error
=
config_parse
(
values
->
values
,
b
,
reader
,
b
->
level
,
0
))
<
0
)
if
((
error
=
config_parse
(
values
->
values
,
b
,
reader
,
b
->
level
,
0
))
<
0
)
goto
out
;
goto
out
;
...
@@ -327,6 +328,7 @@ static int config__refresh(git_config_backend *cfg)
...
@@ -327,6 +328,7 @@ static int config__refresh(git_config_backend *cfg)
out:
out:
refcounted_strmap_free
(
values
);
refcounted_strmap_free
(
values
);
if
(
reader
)
git_buf_free
(
&
reader
->
buffer
);
git_buf_free
(
&
reader
->
buffer
);
return
error
;
return
error
;
}
}
...
@@ -344,8 +346,8 @@ static int config_refresh(git_config_backend *cfg)
...
@@ -344,8 +346,8 @@ static int config_refresh(git_config_backend *cfg)
&
reader
->
buffer
,
reader
->
file_path
,
&
reader
->
buffer
,
reader
->
file_path
,
&
reader
->
file_mtime
,
&
reader
->
file_size
,
&
updated
);
&
reader
->
file_mtime
,
&
reader
->
file_size
,
&
updated
);
if
(
error
<
0
)
if
(
error
<
0
&&
error
!=
GIT_ENOTFOUND
)
return
(
error
==
GIT_ENOTFOUND
)
?
0
:
error
;
return
error
;
if
(
updated
)
if
(
updated
)
any_updated
=
1
;
any_updated
=
1
;
...
...
src/diff_driver.c
View file @
a37aa82e
...
@@ -233,17 +233,17 @@ static int git_diff_driver_load(
...
@@ -233,17 +233,17 @@ static int git_diff_driver_load(
return
0
;
return
0
;
}
}
drv
=
git__calloc
(
1
,
sizeof
(
git_diff_driver
)
+
namelen
+
1
);
GITERR_CHECK_ALLOC
(
drv
);
drv
->
type
=
DIFF_DRIVER_AUTO
;
memcpy
(
drv
->
name
,
driver_name
,
namelen
);
/* if you can't read config for repo, just use default driver */
/* if you can't read config for repo, just use default driver */
if
(
git_repository_config_snapshot
(
&
cfg
,
repo
)
<
0
)
{
if
(
git_repository_config_snapshot
(
&
cfg
,
repo
)
<
0
)
{
giterr_clear
();
giterr_clear
();
goto
done
;
goto
done
;
}
}
drv
=
git__calloc
(
1
,
sizeof
(
git_diff_driver
)
+
namelen
+
1
);
GITERR_CHECK_ALLOC
(
drv
);
drv
->
type
=
DIFF_DRIVER_AUTO
;
memcpy
(
drv
->
name
,
driver_name
,
namelen
);
if
((
error
=
git_buf_printf
(
&
name
,
"diff.%s.binary"
,
driver_name
))
<
0
)
if
((
error
=
git_buf_printf
(
&
name
,
"diff.%s.binary"
,
driver_name
))
<
0
)
goto
done
;
goto
done
;
...
...
src/tag.c
View file @
a37aa82e
...
@@ -363,20 +363,22 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
...
@@ -363,20 +363,22 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
}
}
/* write the buffer */
/* write the buffer */
if
(
git_odb_open_wstream
(
&
stream
,
odb
,
strlen
(
buffer
),
GIT_OBJ_TAG
)
<
0
)
if
((
error
=
git_odb_open_wstream
(
return
-
1
;
&
stream
,
odb
,
strlen
(
buffer
),
GIT_OBJ_TAG
))
<
0
)
return
error
;
git_odb_stream_write
(
stream
,
buffer
,
strlen
(
buffer
));
if
(
!
(
error
=
git_odb_stream_write
(
stream
,
buffer
,
strlen
(
buffer
))))
error
=
git_odb_stream_finalize_write
(
oid
,
stream
);
error
=
git_odb_stream_finalize_write
(
oid
,
stream
);
git_odb_stream_free
(
stream
);
git_odb_stream_free
(
stream
);
if
(
error
<
0
)
{
if
(
error
<
0
)
{
git_buf_free
(
&
ref_name
);
git_buf_free
(
&
ref_name
);
return
-
1
;
return
error
;
}
}
error
=
git_reference_create
(
&
new_ref
,
repo
,
ref_name
.
ptr
,
oid
,
allow_ref_overwrite
,
NULL
,
NULL
);
error
=
git_reference_create
(
&
new_ref
,
repo
,
ref_name
.
ptr
,
oid
,
allow_ref_overwrite
,
NULL
,
NULL
);
git_reference_free
(
new_ref
);
git_reference_free
(
new_ref
);
git_buf_free
(
&
ref_name
);
git_buf_free
(
&
ref_name
);
...
...
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