diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2020-12-08 19:46:25 +0000 |
---|---|---|
committer | Edward Thomson <edward.thomson@vercel.com> | 2023-02-14 16:14:17 +0000 |
commit | 2aed803e7fbdf5ca3cb1eb1c74b16d5b5f2a38dc (patch) | |
tree | 13aae882a6157f12fa05d7f5334adbd28eb50673 | |
parent | 02a909f4a0d3f3da28e35bdf90c1f4598b76daf6 (diff) | |
download | libgit2-2aed803e7fbdf5ca3cb1eb1c74b16d5b5f2a38dc.tar.gz |
threadstate: don't use an unnecessary macroethomson/tlsdata_fail
Now that we've reduced the usage of GIT_THREADSTATE, remove it entirely
in favor of git_threadstate_get().
-rw-r--r-- | src/libgit2/errors.c | 16 | ||||
-rw-r--r-- | src/libgit2/oid.c | 2 | ||||
-rw-r--r-- | src/libgit2/threadstate.h | 2 |
3 files changed, 9 insertions, 11 deletions
diff --git a/src/libgit2/errors.c b/src/libgit2/errors.c index 431af969a..dc177ad0d 100644 --- a/src/libgit2/errors.c +++ b/src/libgit2/errors.c @@ -33,7 +33,7 @@ static git_error tlsdata_error = { static void set_error_from_buffer(int error_class) { - git_threadstate *threadstate = GIT_THREADSTATE; + git_threadstate *threadstate = git_threadstate_get(); git_error *error; git_str *buf; @@ -51,7 +51,7 @@ static void set_error_from_buffer(int error_class) static void set_error(int error_class, char *string) { - git_threadstate *threadstate = GIT_THREADSTATE; + git_threadstate *threadstate = git_threadstate_get(); git_str *buf; if (!threadstate) @@ -71,7 +71,7 @@ static void set_error(int error_class, char *string) void git_error_set_oom(void) { - git_threadstate *threadstate = GIT_THREADSTATE; + git_threadstate *threadstate = git_threadstate_get(); if (!threadstate) return; @@ -90,7 +90,7 @@ void git_error_set(int error_class, const char *fmt, ...) void git_error_vset(int error_class, const char *fmt, va_list ap) { - git_threadstate *threadstate = GIT_THREADSTATE; + git_threadstate *threadstate = git_threadstate_get(); int error_code = (error_class == GIT_ERROR_OS) ? errno : 0; git_str *buf; @@ -135,7 +135,7 @@ void git_error_vset(int error_class, const char *fmt, va_list ap) int git_error_set_str(int error_class, const char *string) { - git_threadstate *threadstate = GIT_THREADSTATE; + git_threadstate *threadstate = git_threadstate_get(); git_str *buf; GIT_ASSERT_ARG(string); @@ -157,7 +157,7 @@ int git_error_set_str(int error_class, const char *string) void git_error_clear(void) { - git_threadstate *threadstate = GIT_THREADSTATE; + git_threadstate *threadstate = git_threadstate_get(); if (!threadstate) return; @@ -181,7 +181,7 @@ const git_error *git_error_last(void) if (!git_libgit2_init_count()) return &uninitialized_error; - if ((threadstate = GIT_THREADSTATE) == NULL) + if ((threadstate = git_threadstate_get()) == NULL) return &tlsdata_error; return threadstate->last_error; @@ -189,7 +189,7 @@ const git_error *git_error_last(void) int git_error_state_capture(git_error_state *state, int error_code) { - git_threadstate *threadstate = GIT_THREADSTATE; + git_threadstate *threadstate = git_threadstate_get(); git_error *error; git_str *error_buf; diff --git a/src/libgit2/oid.c b/src/libgit2/oid.c index ab758fff4..631a566eb 100644 --- a/src/libgit2/oid.c +++ b/src/libgit2/oid.c @@ -155,7 +155,7 @@ int git_oid_pathfmt(char *str, const git_oid *oid) char *git_oid_tostr_s(const git_oid *oid) { - git_threadstate *threadstate = GIT_THREADSTATE; + git_threadstate *threadstate = git_threadstate_get(); char *str; if (!threadstate) diff --git a/src/libgit2/threadstate.h b/src/libgit2/threadstate.h index f9e7ba7bf..adc32cd00 100644 --- a/src/libgit2/threadstate.h +++ b/src/libgit2/threadstate.h @@ -19,6 +19,4 @@ typedef struct { extern int git_threadstate_global_init(void); extern git_threadstate *git_threadstate_get(void); -#define GIT_THREADSTATE (git_threadstate_get()) - #endif |