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
ba02079f
Commit
ba02079f
authored
Oct 28, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid temporary object in lookup routine
parent
364d800b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
src/object.c
+7
-8
No files found.
src/object.c
View file @
ba02079f
...
@@ -374,27 +374,26 @@ int git_object_lookup_bypath(
...
@@ -374,27 +374,26 @@ int git_object_lookup_bypath(
int
error
=
-
1
;
int
error
=
-
1
;
git_tree
*
tree
=
NULL
;
git_tree
*
tree
=
NULL
;
git_tree_entry
*
entry
=
NULL
;
git_tree_entry
*
entry
=
NULL
;
git_object
*
tmpobj
=
NULL
;
assert
(
out
&&
treeish
&&
path
);
assert
(
out
&&
treeish
&&
path
);
if
(((
error
=
git_object_peel
((
git_object
**
)
&
tree
,
treeish
,
GIT_OBJ_TREE
))
<
0
)
||
if
((
error
=
git_object_peel
((
git_object
**
)
&
tree
,
treeish
,
GIT_OBJ_TREE
)
<
0
)
||
((
error
=
git_tree_entry_bypath
(
&
entry
,
tree
,
path
))
<
0
)
||
(
error
=
git_tree_entry_bypath
(
&
entry
,
tree
,
path
))
<
0
)
((
error
=
git_tree_entry_to_object
(
&
tmpobj
,
git_object_owner
(
treeish
),
entry
))
<
0
))
{
{
goto
cleanup
;
goto
cleanup
;
}
}
if
(
type
==
GIT_OBJ_ANY
||
git_object_type
(
tmpobj
)
==
type
)
{
if
(
type
!=
GIT_OBJ_ANY
&&
git_tree_entry_type
(
entry
)
!=
type
)
*
out
=
tmpobj
;
{
}
else
{
giterr_set
(
GITERR_OBJECT
,
giterr_set
(
GITERR_OBJECT
,
"object at path '%s' is not of the asked-for type %d"
,
"object at path '%s' is not of the asked-for type %d"
,
path
,
type
);
path
,
type
);
error
=
GIT_EINVALIDSPEC
;
error
=
GIT_EINVALIDSPEC
;
g
it_object_free
(
tmpobj
)
;
g
oto
cleanup
;
}
}
error
=
git_tree_entry_to_object
(
out
,
git_object_owner
(
treeish
),
entry
);
cleanup:
cleanup:
git_tree_entry_free
(
entry
);
git_tree_entry_free
(
entry
);
git_tree_free
(
tree
);
git_tree_free
(
tree
);
...
...
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