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
8df1cfc9
Commit
8df1cfc9
authored
Jan 24, 2017
by
Carlos Martín Nieto
Committed by
GitHub
Jan 24, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4086 from libgit2/ethomson/fixes
WIP: some coverity & compiler warning fixes
parents
9b51cc82
1f813cf2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
18 deletions
+16
-18
src/attrcache.c
+6
-4
src/integer.h
+6
-6
src/submodule.c
+3
-4
tests/checkout/tree.c
+1
-4
No files found.
src/attrcache.c
View file @
8df1cfc9
...
...
@@ -121,20 +121,22 @@ static int attr_cache_remove(git_attr_cache *cache, git_attr_file *file)
{
int
error
=
0
;
git_attr_file_entry
*
entry
;
git_attr_file
*
old
=
NULL
;
if
(
!
file
)
return
0
;
if
((
error
=
attr_cache_lock
(
cache
))
<
0
)
return
error
;
if
((
entry
=
attr_cache_lookup_entry
(
cache
,
file
->
entry
->
path
))
!=
NULL
)
file
=
git__compare_and_swap
(
&
entry
->
file
[
file
->
source
],
file
,
NULL
);
old
=
git__compare_and_swap
(
&
entry
->
file
[
file
->
source
],
file
,
NULL
);
attr_cache_unlock
(
cache
);
if
(
file
)
{
GIT_REFCOUNT_OWN
(
file
,
NULL
);
git_attr_file__free
(
file
);
if
(
old
)
{
GIT_REFCOUNT_OWN
(
old
,
NULL
);
git_attr_file__free
(
old
);
}
return
error
;
...
...
src/integer.h
View file @
8df1cfc9
...
...
@@ -55,16 +55,16 @@ GIT_INLINE(bool) git__add_uint64_overflow(uint64_t *out, uint64_t one, uint64_t
}
/* Use clang/gcc compiler intrinsics whenever possible */
#if (SIZE_MAX == UINT_MAX) && __has_builtin(__builtin_uadd_overflow)
# define git__add_sizet_overflow(out, one, two) \
__builtin_uadd_overflow(one, two, out)
# define git__multiply_sizet_overflow(out, one, two) \
__builtin_umul_overflow(one, two, out)
#elif (SIZE_MAX == ULONG_MAX) && __has_builtin(__builtin_uaddl_overflow)
#if (SIZE_MAX == ULONG_MAX) && __has_builtin(__builtin_uaddl_overflow)
# define git__add_sizet_overflow(out, one, two) \
__builtin_uaddl_overflow(one, two, out)
# define git__multiply_sizet_overflow(out, one, two) \
__builtin_umull_overflow(one, two, out)
#elif (SIZE_MAX == UINT_MAX) && __has_builtin(__builtin_uadd_overflow)
# define git__add_sizet_overflow(out, one, two) \
__builtin_uadd_overflow(one, two, out)
# define git__multiply_sizet_overflow(out, one, two) \
__builtin_umul_overflow(one, two, out)
#else
/**
...
...
src/submodule.c
View file @
8df1cfc9
...
...
@@ -188,8 +188,7 @@ static int load_submodule_names(git_strmap *out, git_config *cfg)
git_buf_put
(
&
buf
,
fdot
+
1
,
ldot
-
fdot
-
1
);
git_strmap_insert
(
out
,
entry
->
value
,
git_buf_detach
(
&
buf
),
rval
);
if
(
rval
<
0
)
{
giterr_set
(
GITERR_NOMEMORY
,
"Error inserting submodule into hash table"
);
free_submodule_names
(
out
);
giterr_set
(
GITERR_NOMEMORY
,
"error inserting submodule into hash table"
);
return
-
1
;
}
}
...
...
@@ -513,12 +512,12 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
goto
cleanup
;
}
/* add back submodule information from index */
if
(
idx
)
{
if
(
mods
&&
idx
)
{
if
((
error
=
submodules_from_index
(
map
,
idx
,
mods
))
<
0
)
goto
cleanup
;
}
/* add submodule information from HEAD */
if
(
head
)
{
if
(
mods
&&
head
)
{
if
((
error
=
submodules_from_head
(
map
,
head
,
mods
))
<
0
)
goto
cleanup
;
}
...
...
tests/checkout/tree.c
View file @
8df1cfc9
...
...
@@ -441,6 +441,7 @@ void test_checkout_tree__pathlist_checkout_ignores_non_matches(void)
cl_assert
(
git_path_exists
(
"testrepo/link_to_new.txt"
));
cl_assert
(
git_path_exists
(
"testrepo/new.txt"
));
git_object_free
(
g_object
);
cl_git_pass
(
git_revparse_single
(
&
g_object
,
g_repo
,
"8496071c1b46c854b31185ea97743be6a8774479"
));
g_opts
.
checkout_strategy
=
...
...
@@ -454,10 +455,6 @@ void test_checkout_tree__pathlist_checkout_ignores_non_matches(void)
cl_assert
(
!
git_path_exists
(
"testrepo/branch_file.txt"
));
cl_assert
(
!
git_path_exists
(
"testrepo/link_to_new.txt"
));
cl_assert
(
git_path_exists
(
"testrepo/new.txt"
));
git_object_free
(
g_object
);
g_object
=
NULL
;
}
void
test_checkout_tree__can_disable_pattern_match
(
void
)
...
...
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