Skip to content

Commit

Permalink
Change names of types so that mac doesn't cry.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamharrison committed Jul 23, 2024
1 parent 148b3be commit be2e3ed
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/lpm.c
Original file line number Diff line number Diff line change
@@ -65,18 +65,18 @@ typedef struct {
#else
pthread_t thread;
#endif
} thread_t;
} lpm_thread_t;

typedef struct {
#if _WIN32
HANDLE mutex;
#else
pthread_mutex_t mutex;
#endif
} mutex_t;
} lpm_mutex_t;

static mutex_t* new_mutex() {
mutex_t* mutex = malloc(sizeof(mutex_t));
static lpm_mutex_t* new_mutex() {
lpm_mutex_t* mutex = malloc(sizeof(lpm_mutex_t));
#if _WIN32
mutex->mutex = CreateMutex(NULL, FALSE, NULL);
#else
@@ -85,7 +85,7 @@ static mutex_t* new_mutex() {
return mutex;
}

static void free_mutex(mutex_t* mutex) {
static void free_mutex(lpm_mutex_t* mutex) {
#if _WIN32
CloseHandle(mutex->mutex);
#else
@@ -94,15 +94,15 @@ static void free_mutex(mutex_t* mutex) {
free(mutex);
}

static void lock_mutex(mutex_t* mutex) {
static void lock_mutex(lpm_mutex_t* mutex) {
#if _WIN32
WaitForSingleObject(mutex->mutex, INFINITE);
#else
pthread_mutex_lock(&mutex->mutex);
#endif
}

static void unlock_mutex(mutex_t* mutex) {
static void unlock_mutex(lpm_mutex_t* mutex) {
#if _WIN32
ReleaseMutex(mutex->mutex);
#else
@@ -113,14 +113,14 @@ static void unlock_mutex(mutex_t* mutex) {

#if _WIN32
static DWORD windows_thread_callback(void* data) {
thread_t* thread = data;
lpm_thread_t* thread = data;
thread->data = thread->func(thread->data);
return 0;
}
#endif

static thread_t* create_thread(void* (*func)(void*), void* data) {
thread_t* thread = malloc(sizeof(thread_t));
static lpm_thread_t* create_thread(void* (*func)(void*), void* data) {
lpm_thread_t* thread = malloc(sizeof(lpm_thread_t));
#if _WIN32
thread->func = func;
thread->data = data;
@@ -131,7 +131,7 @@ static thread_t* create_thread(void* (*func)(void*), void* data) {
return thread;
}

static void* join_thread(thread_t* thread) {
static void* join_thread(lpm_thread_t* thread) {
if (!thread)
return NULL;
void* retval;
@@ -562,7 +562,7 @@ typedef struct {
int complete;
int error_code;
char data[512];
thread_t* thread;
lpm_thread_t* thread;
} fetch_context_t;

static int lpm_fetch_callback(lua_State* L, const git_transfer_progress *stats) {

0 comments on commit be2e3ed

Please sign in to comment.