Skip to content

Commit ebf2991

Browse files
committed
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().
1 parent 4f76ef5 commit ebf2991

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

src/libgit2/errors.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static git_error tlsdata_error = {
3333

3434
static void set_error_from_buffer(int error_class)
3535
{
36-
git_threadstate *threadstate = GIT_THREADSTATE;
36+
git_threadstate *threadstate = git_threadstate_get();
3737
git_error *error;
3838
git_str *buf;
3939

@@ -51,7 +51,7 @@ static void set_error_from_buffer(int error_class)
5151

5252
static void set_error(int error_class, char *string)
5353
{
54-
git_threadstate *threadstate = GIT_THREADSTATE;
54+
git_threadstate *threadstate = git_threadstate_get();
5555
git_str *buf;
5656

5757
if (!threadstate)
@@ -71,7 +71,7 @@ static void set_error(int error_class, char *string)
7171

7272
void git_error_set_oom(void)
7373
{
74-
git_threadstate *threadstate = GIT_THREADSTATE;
74+
git_threadstate *threadstate = git_threadstate_get();
7575

7676
if (!threadstate)
7777
return;
@@ -94,7 +94,7 @@ void git_error_vset(int error_class, const char *fmt, va_list ap)
9494
DWORD win32_error_code = (error_class == GIT_ERROR_OS) ? GetLastError() : 0;
9595
#endif
9696

97-
git_threadstate *threadstate = GIT_THREADSTATE;
97+
git_threadstate *threadstate = git_threadstate_get();
9898
int error_code = (error_class == GIT_ERROR_OS) ? errno : 0;
9999
git_str *buf;
100100

@@ -135,7 +135,7 @@ void git_error_vset(int error_class, const char *fmt, va_list ap)
135135

136136
int git_error_set_str(int error_class, const char *string)
137137
{
138-
git_threadstate *threadstate = GIT_THREADSTATE;
138+
git_threadstate *threadstate = git_threadstate_get();
139139
git_str *buf;
140140

141141
GIT_ASSERT_ARG(string);
@@ -157,7 +157,7 @@ int git_error_set_str(int error_class, const char *string)
157157

158158
void git_error_clear(void)
159159
{
160-
git_threadstate *threadstate = GIT_THREADSTATE;
160+
git_threadstate *threadstate = git_threadstate_get();
161161

162162
if (!threadstate)
163163
return;
@@ -181,15 +181,15 @@ const git_error *git_error_last(void)
181181
if (!git_libgit2_init_count())
182182
return &uninitialized_error;
183183

184-
if ((threadstate = GIT_THREADSTATE) == NULL)
184+
if ((threadstate = git_threadstate_get()) == NULL)
185185
return &tlsdata_error;
186186

187187
return threadstate->last_error;
188188
}
189189

190190
int git_error_state_capture(git_error_state *state, int error_code)
191191
{
192-
git_threadstate *threadstate = GIT_THREADSTATE;
192+
git_threadstate *threadstate = git_threadstate_get();
193193
git_error *error;
194194
git_str *error_buf;
195195

src/libgit2/oid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ int git_oid_pathfmt(char *str, const git_oid *oid)
155155

156156
char *git_oid_tostr_s(const git_oid *oid)
157157
{
158-
git_threadstate *threadstate = GIT_THREADSTATE;
158+
git_threadstate *threadstate = git_threadstate_get();
159159
char *str;
160160

161161
if (!threadstate)

src/libgit2/threadstate.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,4 @@ typedef struct {
1919
extern int git_threadstate_global_init(void);
2020
extern git_threadstate *git_threadstate_get(void);
2121

22-
#define GIT_THREADSTATE (git_threadstate_get())
23-
2422
#endif

0 commit comments

Comments
 (0)