File tree Expand file tree Collapse file tree 6 files changed +10
-10
lines changed
Expand file tree Collapse file tree 6 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -411,7 +411,7 @@ static git_diff_generated *diff_generated_alloc(
411411 if ((diff = git__calloc (1 , sizeof (git_diff_generated ))) == NULL )
412412 return NULL ;
413413
414- GIT_REFCOUNT_INC (diff );
414+ GIT_REFCOUNT_INC (& diff -> base );
415415 diff -> base .type = GIT_DIFF_TYPE_GENERATED ;
416416 diff -> base .repo = repo ;
417417 diff -> base .old_src = old_iter -> type ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ static git_diff_parsed *diff_parsed_alloc(void)
3636 if ((diff = git__calloc (1 , sizeof (git_diff_parsed ))) == NULL )
3737 return NULL ;
3838
39- GIT_REFCOUNT_INC (diff );
39+ GIT_REFCOUNT_INC (& diff -> base );
4040 diff -> base .type = GIT_DIFF_TYPE_PARSED ;
4141 diff -> base .strcomp = git__strcmp ;
4242 diff -> base .strncomp = git__strncmp ;
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ static int patch_generated_alloc_from_diff(
139139
140140 if (!(error = patch_generated_init (patch , diff , delta_index ))) {
141141 patch -> flags |= GIT_PATCH_GENERATED_ALLOCATED ;
142- GIT_REFCOUNT_INC (patch );
142+ GIT_REFCOUNT_INC (& patch -> base );
143143 } else {
144144 git__free (patch );
145145 patch = NULL ;
Original file line number Diff line number Diff line change @@ -1084,7 +1084,7 @@ int git_patch_parse(
10841084 patch -> base .diff_opts .new_prefix = patch -> new_prefix ;
10851085 patch -> base .diff_opts .flags |= GIT_DIFF_SHOW_BINARY ;
10861086
1087- GIT_REFCOUNT_INC (patch );
1087+ GIT_REFCOUNT_INC (& patch -> base );
10881088 * out = & patch -> base ;
10891089
10901090done :
Original file line number Diff line number Diff line change 1010#include <ctype.h>
1111
1212#include "git2/object.h"
13- #include "git2/refdb.h"
1413#include "git2/sys/repository.h"
1514
1615#include "common.h"
2524#include "refs.h"
2625#include "filter.h"
2726#include "odb.h"
27+ #include "refdb.h"
2828#include "remote.h"
2929#include "merge.h"
3030#include "diff_driver.h"
Original file line number Diff line number Diff line change @@ -297,22 +297,22 @@ typedef struct {
297297typedef void (* git_refcount_freeptr )(void * r );
298298
299299#define GIT_REFCOUNT_INC (r ) { \
300- git_atomic_inc(&((git_refcount *)(r))-> refcount); \
300+ git_atomic_inc(&(r)->rc. refcount); \
301301}
302302
303303#define GIT_REFCOUNT_DEC (_r , do_free ) { \
304- git_refcount *r = (git_refcount *)( _r); \
304+ git_refcount *r = &( _r)->rc ; \
305305 int val = git_atomic_dec(&r->refcount); \
306306 if (val <= 0 && r->owner == NULL) { do_free(_r); } \
307307}
308308
309309#define GIT_REFCOUNT_OWN (r , o ) { \
310- ((git_refcount *)(r))-> owner = o; \
310+ (r)->rc. owner = o; \
311311}
312312
313- #define GIT_REFCOUNT_OWNER (r ) (((git_refcount *)(r))-> owner)
313+ #define GIT_REFCOUNT_OWNER (r ) ((r)->rc. owner)
314314
315- #define GIT_REFCOUNT_VAL (r ) git_atomic_get(&((git_refcount *)(r))-> refcount)
315+ #define GIT_REFCOUNT_VAL (r ) git_atomic_get((r)->rc. refcount)
316316
317317
318318static signed char from_hex [] = {
You can’t perform that action at this time.
0 commit comments