@@ -22,33 +22,32 @@ typedef struct {
2222 const char * str ; /* type name string */
2323 size_t size ; /* size in bytes of the object structure */
2424
25- int (* from_odb )(void * self , git_odb_object * obj );
26- int (* parse )(void * self , const char * buf , const char * buf_end );
25+ int (* parse )(void * self , git_odb_object * obj );
2726 void (* free )(void * self );
2827} git_object_def ;
2928
3029static git_object_def git_objects_table [] = {
3130 /* 0 = GIT_OBJ__EXT1 */
32- { "" , 0 , NULL , NULL , NULL },
31+ { "" , 0 , NULL , NULL },
3332
3433 /* 1 = GIT_OBJ_COMMIT */
35- { "commit" , sizeof (git_commit ), NULL , git_commit__parse , git_commit__free },
34+ { "commit" , sizeof (git_commit ), git_commit__parse , git_commit__free },
3635
3736 /* 2 = GIT_OBJ_TREE */
38- { "tree" , sizeof (git_tree ), NULL , git_tree__parse , git_tree__free },
37+ { "tree" , sizeof (git_tree ), git_tree__parse , git_tree__free },
3938
4039 /* 3 = GIT_OBJ_BLOB */
41- { "blob" , sizeof (git_blob ), git_blob__from_odb_object , NULL , git_blob__free },
40+ { "blob" , sizeof (git_blob ), git_blob__parse , git_blob__free },
4241
4342 /* 4 = GIT_OBJ_TAG */
44- { "tag" , sizeof (git_tag ), NULL , git_tag__parse , git_tag__free },
43+ { "tag" , sizeof (git_tag ), git_tag__parse , git_tag__free },
4544
4645 /* 5 = GIT_OBJ__EXT2 */
47- { "" , 0 , NULL , NULL , NULL },
46+ { "" , 0 , NULL , NULL },
4847 /* 6 = GIT_OBJ_OFS_DELTA */
49- { "OFS_DELTA" , 0 , NULL , NULL , NULL },
48+ { "OFS_DELTA" , 0 , NULL , NULL },
5049 /* 7 = GIT_OBJ_REF_DELTA */
51- { "REF_DELTA" , 0 , NULL , NULL , NULL },
50+ { "REF_DELTA" , 0 , NULL , NULL },
5251};
5352
5453int git_object__from_odb_object (
@@ -88,22 +87,14 @@ int git_object__from_odb_object(
8887
8988 /* Parse raw object data */
9089 def = & git_objects_table [odb_obj -> cached .type ];
91- assert (def -> free && ( def -> from_odb || def -> parse ) );
90+ assert (def -> free && def -> parse );
9291
93- if (def -> from_odb ) {
94- error = def -> from_odb (object , odb_obj );
95- } else {
96- const char * data = (const char * )git_odb_object_data (odb_obj );
97- error = def -> parse (object , data , data + git_odb_object_size (odb_obj ));
98- }
99-
100- if (error < 0 ) {
92+ if ((error = def -> parse (object , odb_obj )) < 0 )
10193 def -> free (object );
102- return error ;
103- }
94+ else
95+ * object_out = git_cache_store_parsed ( & repo -> objects , object );
10496
105- * object_out = git_cache_store_parsed (& repo -> objects , object );
106- return 0 ;
97+ return error ;
10798}
10899
109100void git_object__free (void * obj )
0 commit comments