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
fba70a9d
Unverified
Commit
fba70a9d
authored
Jan 03, 2019
by
Edward Thomson
Committed by
GitHub
Jan 03, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4919 from pks-t/pks/shutdown-cb-count
Shutdown callback count
parents
9084712b
b46c3594
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
20 deletions
+49
-20
src/global.c
+22
-14
src/hash.h
+2
-1
src/hash/hash_collisiondetect.h
+5
-1
src/hash/hash_common_crypto.h
+5
-1
src/hash/hash_generic.h
+5
-1
src/hash/hash_mbedtls.h
+5
-1
src/hash/hash_openssl.h
+5
-1
No files found.
src/global.c
View file @
fba70a9d
...
...
@@ -26,9 +26,23 @@
git_mutex
git__mwindow_mutex
;
#define MAX_SHUTDOWN_CB 10
typedef
int
(
*
git_global_init_fn
)(
void
);
static
git_global_init_fn
git__init_callbacks
[]
=
{
git_allocator_global_init
,
git_hash_global_init
,
git_sysdir_global_init
,
git_filter_global_init
,
git_merge_driver_global_init
,
git_transport_ssh_global_init
,
git_stream_registry_global_init
,
git_openssl_stream_global_init
,
git_mbedtls_stream_global_init
,
git_mwindow_global_init
};
static
git_global_shutdown_fn
git__shutdown_callbacks
[
ARRAY_SIZE
(
git__init_callbacks
)];
static
git_global_shutdown_fn
git__shutdown_callbacks
[
MAX_SHUTDOWN_CB
];
static
git_atomic
git__n_shutdown_callbacks
;
static
git_atomic
git__n_inits
;
char
*
git__user_agent
;
...
...
@@ -37,7 +51,7 @@ char *git__ssl_ciphers;
void
git__on_shutdown
(
git_global_shutdown_fn
callback
)
{
int
count
=
git_atomic_inc
(
&
git__n_shutdown_callbacks
);
assert
(
count
<=
MAX_SHUTDOWN_CB
&&
count
>
0
);
assert
(
count
<=
(
int
)
ARRAY_SIZE
(
git__shutdown_callbacks
)
&&
count
>
0
);
git__shutdown_callbacks
[
count
-
1
]
=
callback
;
}
...
...
@@ -52,6 +66,7 @@ static void git__global_state_cleanup(git_global_st *st)
static
int
init_common
(
void
)
{
size_t
i
;
int
ret
;
/* Initialize the CRT debug allocator first, before our first malloc */
...
...
@@ -60,17 +75,10 @@ static int init_common(void)
git_win32__stack_init
();
#endif
/* Initialize any other subsystems that have global state */
if
((
ret
=
git_allocator_global_init
())
==
0
&&
(
ret
=
git_hash_global_init
())
==
0
&&
(
ret
=
git_sysdir_global_init
())
==
0
&&
(
ret
=
git_filter_global_init
())
==
0
&&
(
ret
=
git_merge_driver_global_init
())
==
0
&&
(
ret
=
git_transport_ssh_global_init
())
==
0
&&
(
ret
=
git_stream_registry_global_init
())
==
0
&&
(
ret
=
git_openssl_stream_global_init
())
==
0
&&
(
ret
=
git_mbedtls_stream_global_init
())
==
0
)
ret
=
git_mwindow_global_init
();
/* Initialize subsystems that have global state */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
git__init_callbacks
);
i
++
)
if
((
ret
=
git__init_callbacks
[
i
]())
!=
0
)
break
;
GIT_MEMORY_BARRIER
;
...
...
src/hash.h
View file @
fba70a9d
...
...
@@ -14,7 +14,6 @@
typedef
struct
git_hash_prov
git_hash_prov
;
typedef
struct
git_hash_ctx
git_hash_ctx
;
int
git_hash_global_init
(
void
);
int
git_hash_ctx_init
(
git_hash_ctx
*
ctx
);
void
git_hash_ctx_cleanup
(
git_hash_ctx
*
ctx
);
...
...
@@ -32,6 +31,8 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx);
# include "hash/hash_generic.h"
#endif
int
git_hash_global_init
(
void
);
typedef
struct
{
void
*
data
;
size_t
len
;
...
...
src/hash/hash_collisiondetect.h
View file @
fba70a9d
...
...
@@ -15,10 +15,14 @@ struct git_hash_ctx {
SHA1_CTX
c
;
};
#define git_hash_global_init() 0
#define git_hash_ctx_init(ctx) git_hash_init(ctx)
#define git_hash_ctx_cleanup(ctx)
GIT_INLINE
(
int
)
git_hash_global_init
(
void
)
{
return
0
;
}
GIT_INLINE
(
int
)
git_hash_init
(
git_hash_ctx
*
ctx
)
{
assert
(
ctx
);
...
...
src/hash/hash_common_crypto.h
View file @
fba70a9d
...
...
@@ -18,10 +18,14 @@ struct git_hash_ctx {
#define CC_LONG_MAX ((CC_LONG)-1)
#define git_hash_global_init() 0
#define git_hash_ctx_init(ctx) git_hash_init(ctx)
#define git_hash_ctx_cleanup(ctx)
GIT_INLINE
(
int
)
git_hash_global_init
(
void
)
{
return
0
;
}
GIT_INLINE
(
int
)
git_hash_init
(
git_hash_ctx
*
ctx
)
{
assert
(
ctx
);
...
...
src/hash/hash_generic.h
View file @
fba70a9d
...
...
@@ -18,8 +18,12 @@ struct git_hash_ctx {
unsigned
int
W
[
16
];
};
#define git_hash_global_init() 0
#define git_hash_ctx_init(ctx) git_hash_init(ctx)
#define git_hash_ctx_cleanup(ctx)
GIT_INLINE
(
int
)
git_hash_global_init
(
void
)
{
return
0
;
}
#endif
src/hash/hash_mbedtls.h
View file @
fba70a9d
...
...
@@ -14,7 +14,11 @@ struct git_hash_ctx {
mbedtls_sha1_context
c
;
};
#define git_hash_global_init() 0
#define git_hash_ctx_init(ctx) git_hash_init(ctx)
GIT_INLINE
(
int
)
git_hash_global_init
(
void
)
{
return
0
;
}
#endif
/* INCLUDE_hash_mbedtld_h__ */
src/hash/hash_openssl.h
View file @
fba70a9d
...
...
@@ -16,10 +16,14 @@ struct git_hash_ctx {
SHA_CTX
c
;
};
#define git_hash_global_init() 0
#define git_hash_ctx_init(ctx) git_hash_init(ctx)
#define git_hash_ctx_cleanup(ctx)
GIT_INLINE
(
int
)
git_hash_global_init
(
void
)
{
return
0
;
}
GIT_INLINE
(
int
)
git_hash_init
(
git_hash_ctx
*
ctx
)
{
assert
(
ctx
);
...
...
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