Commit ebf2991f by Edward Thomson

threadstate: don't use an unnecessary macro

Now that we've reduced the usage of GIT_THREADSTATE, remove it entirely
in favor of git_threadstate_get().
parent 4f76ef56
...@@ -33,7 +33,7 @@ static git_error tlsdata_error = { ...@@ -33,7 +33,7 @@ static git_error tlsdata_error = {
static void set_error_from_buffer(int error_class) static void set_error_from_buffer(int error_class)
{ {
git_threadstate *threadstate = GIT_THREADSTATE; git_threadstate *threadstate = git_threadstate_get();
git_error *error; git_error *error;
git_str *buf; git_str *buf;
...@@ -51,7 +51,7 @@ static void set_error_from_buffer(int error_class) ...@@ -51,7 +51,7 @@ static void set_error_from_buffer(int error_class)
static void set_error(int error_class, char *string) static void set_error(int error_class, char *string)
{ {
git_threadstate *threadstate = GIT_THREADSTATE; git_threadstate *threadstate = git_threadstate_get();
git_str *buf; git_str *buf;
if (!threadstate) if (!threadstate)
...@@ -71,7 +71,7 @@ static void set_error(int error_class, char *string) ...@@ -71,7 +71,7 @@ static void set_error(int error_class, char *string)
void git_error_set_oom(void) void git_error_set_oom(void)
{ {
git_threadstate *threadstate = GIT_THREADSTATE; git_threadstate *threadstate = git_threadstate_get();
if (!threadstate) if (!threadstate)
return; return;
...@@ -94,7 +94,7 @@ void git_error_vset(int error_class, const char *fmt, va_list ap) ...@@ -94,7 +94,7 @@ void git_error_vset(int error_class, const char *fmt, va_list ap)
DWORD win32_error_code = (error_class == GIT_ERROR_OS) ? GetLastError() : 0; DWORD win32_error_code = (error_class == GIT_ERROR_OS) ? GetLastError() : 0;
#endif #endif
git_threadstate *threadstate = GIT_THREADSTATE; git_threadstate *threadstate = git_threadstate_get();
int error_code = (error_class == GIT_ERROR_OS) ? errno : 0; int error_code = (error_class == GIT_ERROR_OS) ? errno : 0;
git_str *buf; git_str *buf;
...@@ -135,7 +135,7 @@ void git_error_vset(int error_class, const char *fmt, va_list ap) ...@@ -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) 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_str *buf;
GIT_ASSERT_ARG(string); GIT_ASSERT_ARG(string);
...@@ -157,7 +157,7 @@ int git_error_set_str(int error_class, const char *string) ...@@ -157,7 +157,7 @@ int git_error_set_str(int error_class, const char *string)
void git_error_clear(void) void git_error_clear(void)
{ {
git_threadstate *threadstate = GIT_THREADSTATE; git_threadstate *threadstate = git_threadstate_get();
if (!threadstate) if (!threadstate)
return; return;
...@@ -181,7 +181,7 @@ const git_error *git_error_last(void) ...@@ -181,7 +181,7 @@ const git_error *git_error_last(void)
if (!git_libgit2_init_count()) if (!git_libgit2_init_count())
return &uninitialized_error; return &uninitialized_error;
if ((threadstate = GIT_THREADSTATE) == NULL) if ((threadstate = git_threadstate_get()) == NULL)
return &tlsdata_error; return &tlsdata_error;
return threadstate->last_error; return threadstate->last_error;
...@@ -189,7 +189,7 @@ const git_error *git_error_last(void) ...@@ -189,7 +189,7 @@ const git_error *git_error_last(void)
int git_error_state_capture(git_error_state *state, int error_code) 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_error *error;
git_str *error_buf; git_str *error_buf;
......
...@@ -155,7 +155,7 @@ int git_oid_pathfmt(char *str, const git_oid *oid) ...@@ -155,7 +155,7 @@ int git_oid_pathfmt(char *str, const git_oid *oid)
char *git_oid_tostr_s(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; char *str;
if (!threadstate) if (!threadstate)
......
...@@ -19,6 +19,4 @@ typedef struct { ...@@ -19,6 +19,4 @@ typedef struct {
extern int git_threadstate_global_init(void); extern int git_threadstate_global_init(void);
extern git_threadstate *git_threadstate_get(void); extern git_threadstate *git_threadstate_get(void);
#define GIT_THREADSTATE (git_threadstate_get())
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment