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
f039c836
Unverified
Commit
f039c836
authored
Jul 29, 2019
by
Carlos Martín Nieto
Committed by
GitHub
Jul 29, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5192 from libgit2/cmn/object-size-nopublic
object: deprecate git_object__size for removal
parents
e3adc99e
c8e249b0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
24 deletions
+16
-24
include/git2/deprecated.h
+12
-0
include/git2/object.h
+0
-14
src/object.c
+4
-10
No files found.
include/git2/deprecated.h
View file @
f039c836
...
...
@@ -301,6 +301,18 @@ GIT_EXTERN(int) git_index_add_frombuffer(
#define GIT_OBJ_OFS_DELTA GIT_OBJECT_OFS_DELTA
#define GIT_OBJ_REF_DELTA GIT_OBJECT_REF_DELTA
/**
* Get the size in bytes for the structure which
* acts as an in-memory representation of any given
* object type.
*
* For all the core types, this would the equivalent
* of calling `sizeof(git_commit)` if the core types
* were not opaque on the external API.
*
* @param type object type to get its size
* @return size in bytes of the object
*/
GIT_EXTERN
(
size_t
)
git_object__size
(
git_object_t
type
);
/**@}*/
...
...
include/git2/object.h
View file @
f039c836
...
...
@@ -186,20 +186,6 @@ GIT_EXTERN(git_object_t) git_object_string2type(const char *str);
GIT_EXTERN
(
int
)
git_object_typeisloose
(
git_object_t
type
);
/**
* Get the size in bytes for the structure which
* acts as an in-memory representation of any given
* object type.
*
* For all the core types, this would the equivalent
* of calling `sizeof(git_commit)` if the core types
* were not opaque on the external API.
*
* @param type object type to get its size
* @return size in bytes of the object
*/
GIT_EXTERN
(
size_t
)
git_object_size
(
git_object_t
type
);
/**
* Recursively peel an object until an object of the specified type is met.
*
* If the query cannot be satisfied due to the object model,
...
...
src/object.c
View file @
f039c836
...
...
@@ -21,6 +21,7 @@
bool
git_object__strict_input_validation
=
true
;
extern
int
git_odb_hash
(
git_oid
*
out
,
const
void
*
data
,
size_t
len
,
git_object_t
type
);
size_t
git_object__size
(
git_object_t
type
);
typedef
struct
{
const
char
*
str
;
/* type name string */
...
...
@@ -75,7 +76,7 @@ int git_object__from_raw(
return
GIT_ENOTFOUND
;
}
if
((
object_size
=
git_object_size
(
type
))
==
0
)
{
if
((
object_size
=
git_object_
_
size
(
type
))
==
0
)
{
git_error_set
(
GIT_ERROR_INVALID
,
"the requested type is invalid"
);
return
GIT_ENOTFOUND
;
}
...
...
@@ -123,7 +124,7 @@ int git_object__from_odb_object(
return
GIT_ENOTFOUND
;
}
if
((
object_size
=
git_object_size
(
odb_obj
->
cached
.
type
))
==
0
)
{
if
((
object_size
=
git_object_
_
size
(
odb_obj
->
cached
.
type
))
==
0
)
{
git_error_set
(
GIT_ERROR_INVALID
,
"the requested type is invalid"
);
return
GIT_ENOTFOUND
;
}
...
...
@@ -316,7 +317,7 @@ int git_object_typeisloose(git_object_t type)
return
(
git_objects_table
[
type
].
size
>
0
)
?
1
:
0
;
}
size_t
git_object_size
(
git_object_t
type
)
size_t
git_object_
_
size
(
git_object_t
type
)
{
if
(
type
<
0
||
((
size_t
)
type
)
>=
ARRAY_SIZE
(
git_objects_table
))
return
0
;
...
...
@@ -549,10 +550,3 @@ bool git_object__is_valid(
return
true
;
}
/* Deprecated functions */
size_t
git_object__size
(
git_object_t
type
)
{
return
git_object_size
(
type
);
}
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