Skip to content

Commit

Permalink
Fix more prototypes;
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornbytes committed Apr 26, 2023
1 parent ad4978f commit cb44549
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/core/gpu_vk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2667,7 +2667,7 @@ static void condemn(void* handle, VkObjectType type) {
morgue->data[morgue->head++ & MORGUE_MASK] = (gpu_victim) { handle, type, state.tick[CPU] };
}

static void expunge() {
static void expunge(void) {
gpu_morgue* morgue = &state.morgue;
while (morgue->tail != morgue->head && state.tick[GPU] >= morgue->data[morgue->tail & MORGUE_MASK].tick) {
gpu_victim* victim = &morgue->data[morgue->tail++ & MORGUE_MASK];
Expand Down
20 changes: 10 additions & 10 deletions src/core/os_android.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ void android_main(struct android_app* app) {
(*app->activity->vm)->DetachCurrentThread(app->activity->vm);
}

bool os_init() {
bool os_init(void) {
return true;
}

void os_destroy() {
void os_destroy(void) {
// There are two ways a quit can happen, which need to be handled slightly differently:
// - If the system tells us to quit, we get an event with APP_CMD_DESTROY. In response we push a
// QUIT event to lovr.event and main will eventually exit cleanly. No other teardown necessary.
Expand All @@ -189,11 +189,11 @@ void os_destroy() {
memset(&state, 0, sizeof(state));
}

const char* os_get_name() {
const char* os_get_name(void) {
return "Android";
}

uint32_t os_get_core_count() {
uint32_t os_get_core_count(void) {
return sysconf(_SC_NPROCESSORS_ONLN);
}

Expand All @@ -220,14 +220,14 @@ static void* log_main(void* data) {
return 0;
}

void os_open_console() {
void os_open_console(void) {
pthread_create(&log.thread, NULL, log_main, log.handles);
pthread_detach(log.thread);
}

#define NS_PER_SEC 1000000000ULL

double os_get_time() {
double os_get_time(void) {
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
return (double) t.tv_sec + (t.tv_nsec / (double) NS_PER_SEC);
Expand Down Expand Up @@ -287,7 +287,7 @@ bool os_vm_release(void* p, size_t size) {
// - Block if the app is paused or no window is present
// - If the app was active and becomes inactive after an event, break instead of waiting for
// another event. This gives the main loop a chance to respond (e.g. exit VR mode).
void os_poll_events() {
void os_poll_events(void) {
while (!state.app->destroyRequested) {
int events;
struct android_poll_source* source;
Expand Down Expand Up @@ -342,7 +342,7 @@ bool os_window_open(const os_window_config* config) {
return true;
}

bool os_window_is_open() {
bool os_window_is_open(void) {
return false;
}

Expand Down Expand Up @@ -426,11 +426,11 @@ bool os_is_key_down(os_key key) {

// Private, must be declared manually to use

void* os_get_java_vm() {
void* os_get_java_vm(void) {
return state.app->activity->vm;
}

void* os_get_jni_context() {
void* os_get_jni_context(void) {
return state.app->activity->clazz;
}

Expand Down
14 changes: 7 additions & 7 deletions src/core/os_glfw.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#ifndef LOVR_USE_GLFW

void os_destroy() {
void os_destroy(void) {
//
}

void os_poll_events() {
void os_poll_events(void) {
//
}

bool os_window_open(const os_window_config* config) {
return false;
}

bool os_window_is_open() {
bool os_window_is_open(void) {
return false;
}

Expand Down Expand Up @@ -276,11 +276,11 @@ static int convertKey(os_key key) {
}
}

void os_destroy() {
void os_destroy(void) {
glfwTerminate();
}

void os_poll_events() {
void os_poll_events(void) {
if (glfwState.window) {
glfwPollEvents();
}
Expand Down Expand Up @@ -341,7 +341,7 @@ bool os_window_open(const os_window_config* config) {
return true;
}

bool os_window_is_open() {
bool os_window_is_open(void) {
return glfwState.window;
}

Expand Down Expand Up @@ -420,7 +420,7 @@ bool os_is_key_down(os_key key) {
}

#ifdef _WIN32
HANDLE os_get_win32_window() {
HANDLE os_get_win32_window(void) {
return (HANDLE) glfwGetWin32Window(glfwState.window);
}
#endif
Expand Down
10 changes: 5 additions & 5 deletions src/core/os_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@

#define NS_PER_SEC 1000000000ULL

bool os_init() {
bool os_init(void) {
return true;
}

const char* os_get_name() {
const char* os_get_name(void) {
return "Linux";
}

uint32_t os_get_core_count() {
uint32_t os_get_core_count(void) {
return sysconf(_SC_NPROCESSORS_ONLN);
}

void os_open_console() {
void os_open_console(void) {
//
}

double os_get_time() {
double os_get_time(void) {
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
return (double) t.tv_sec + (t.tv_nsec / (double) NS_PER_SEC);
Expand Down
10 changes: 5 additions & 5 deletions src/core/os_macos.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@ static struct {
fn_permission* onPermissionEvent;
} state;

bool os_init() {
bool os_init(void) {
mach_timebase_info_data_t info;
mach_timebase_info(&info);
state.frequency = (info.denom * 1e9) / info.numer;
return true;
}

const char* os_get_name() {
const char* os_get_name(void) {
return "macOS";
}

uint32_t os_get_core_count() {
uint32_t os_get_core_count(void) {
uint32_t count;
size_t size = sizeof(count);
sysctlbyname("hw.logicalcpu", &count, &size, NULL, 0);
return count;
}

void os_open_console() {
void os_open_console(void) {
//
}

double os_get_time() {
double os_get_time(void) {
return mach_absolute_time() / (double) state.frequency;
}

Expand Down
10 changes: 5 additions & 5 deletions src/core/os_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,24 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE prev, LPSTR args, int show) {

#endif

bool os_init() {
bool os_init(void) {
LARGE_INTEGER f;
QueryPerformanceFrequency(&f);
frequency = f.QuadPart;
return true;
}

const char* os_get_name() {
const char* os_get_name(void) {
return "Windows";
}

uint32_t os_get_core_count() {
uint32_t os_get_core_count(void) {
SYSTEM_INFO info;
GetSystemInfo(&info);
return info.dwNumberOfProcessors;
}

void os_open_console() {
void os_open_console(void) {
if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
if (GetLastError() != ERROR_ACCESS_DENIED) {
if (!AllocConsole()) {
Expand All @@ -86,7 +86,7 @@ void os_open_console() {
freopen("CONOUT$", "w", stderr);
}

double os_get_time() {
double os_get_time(void) {
LARGE_INTEGER t;
QueryPerformanceCounter(&t);
return t.QuadPart / (double) frequency;
Expand Down
6 changes: 3 additions & 3 deletions src/modules/audio/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ bool lovrAudioInit(const char* spatializer, uint32_t sampleRate) {
return state.initialized = true;
}

void lovrAudioDestroy() {
void lovrAudioDestroy(void) {
if (!state.initialized) return;
for (size_t i = 0; i < 2; i++) {
ma_device_uninit(&state.devices[i]);
Expand Down Expand Up @@ -362,11 +362,11 @@ bool lovrAudioSetGeometry(float* vertices, uint32_t* indices, uint32_t vertexCou
return success;
}

const char* lovrAudioGetSpatializer() {
const char* lovrAudioGetSpatializer(void) {
return state.spatializer->name;
}

uint32_t lovrAudioGetSampleRate() {
uint32_t lovrAudioGetSampleRate(void) {
return state.sampleRate;
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/audio/spatializer_phonon.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ bool phonon_init(void) {
return true;
}

void phonon_destroy() {
void phonon_destroy(void) {
if (state.scratchpad) free(state.scratchpad);
for (size_t i = 0; i < MAX_SOURCES; i++) {
if (state.binauralEffect[i]) phonon_iplDestroyBinauralEffect(&state.binauralEffect[i]);
Expand Down
8 changes: 4 additions & 4 deletions src/modules/event/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ void lovrVariantDestroy(Variant* variant) {
}
}

bool lovrEventInit() {
bool lovrEventInit(void) {
if (state.initialized) return false;
arr_init(&state.events, arr_alloc);
return state.initialized = true;
}

void lovrEventDestroy() {
void lovrEventDestroy(void) {
if (!state.initialized) return;
for (size_t i = state.head; i < state.events.length; i++) {
Event* event = &state.events.data[i];
Expand All @@ -46,7 +46,7 @@ void lovrEventDestroy() {
memset(&state, 0, sizeof(state));
}

void lovrEventPump() {
void lovrEventPump(void) {
os_poll_events();
}

Expand Down Expand Up @@ -76,7 +76,7 @@ bool lovrEventPoll(Event* event) {
return true;
}

void lovrEventClear() {
void lovrEventClear(void) {
arr_clear(&state.events);
state.head = 0;
}
14 changes: 7 additions & 7 deletions src/modules/graphics/graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ bool lovrGraphicsInit(GraphicsConfig* config) {
return true;
}

void lovrGraphicsDestroy() {
void lovrGraphicsDestroy(void) {
if (!state.initialized) return;
#ifndef LOVR_DISABLE_HEADSET
// If there's an active headset session it needs to be stopped so it can clean up its Pass and
Expand Down Expand Up @@ -770,7 +770,7 @@ void lovrGraphicsDestroy() {
memset(&state, 0, sizeof(state));
}

bool lovrGraphicsIsInitialized() {
bool lovrGraphicsIsInitialized(void) {
return state.initialized;
}

Expand Down Expand Up @@ -1100,7 +1100,7 @@ void lovrGraphicsSubmit(Pass** passes, uint32_t count) {
releasePassResources();
}

void lovrGraphicsPresent() {
void lovrGraphicsPresent(void) {
if (state.presentable) {
state.window->gpu = NULL;
state.window->renderView = NULL;
Expand All @@ -1109,7 +1109,7 @@ void lovrGraphicsPresent() {
}
}

void lovrGraphicsWait() {
void lovrGraphicsWait(void) {
gpu_wait_idle();
}

Expand Down Expand Up @@ -1305,7 +1305,7 @@ void lovrBufferClear(Buffer* buffer, uint32_t offset, uint32_t size) {

// Texture

Texture* lovrGraphicsGetWindowTexture() {
Texture* lovrGraphicsGetWindowTexture(void) {
if (!state.window->gpu) {
beginFrame();

Expand Down Expand Up @@ -2326,7 +2326,7 @@ const MaterialInfo* lovrMaterialGetInfo(Material* material) {

// Font

Font* lovrGraphicsGetDefaultFont() {
Font* lovrGraphicsGetDefaultFont(void) {
if (!state.defaultFont) {
Rasterizer* rasterizer = lovrRasterizerCreate(NULL, 32);
state.defaultFont = lovrFontCreate(&(FontInfo) {
Expand Down Expand Up @@ -3667,7 +3667,7 @@ static void lovrPassCheckValid(Pass* pass) {
lovrCheck(pass->tick == state.tick, "Passes can only be used for a single frame (unable to use this Pass again because lovr.graphics.submit has been called since it was created)");
}

Pass* lovrGraphicsGetWindowPass() {
Pass* lovrGraphicsGetWindowPass(void) {
if (!state.windowPass && state.window) {
Texture* window = lovrGraphicsGetWindowTexture();

Expand Down
4 changes: 2 additions & 2 deletions src/modules/headset/headset_webxr.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extern double webxr_update(void);
static bool webxrAttached = false;
static HeadsetInterface* previousHeadsetDriver;

void webxr_attach() {
void webxr_attach(void) {
if (webxrAttached || lovrHeadsetInterface == &lovrHeadsetWebXRDriver) {
return;
}
Expand All @@ -43,7 +43,7 @@ void webxr_attach() {
webxrAttached = true;
}

void webxr_detach() {
void webxr_detach(void) {
if (!webxrAttached) {
return;
}
Expand Down
Loading

0 comments on commit cb44549

Please sign in to comment.