[all] use explicit void parameter lists

This makes it a compile-time error to call a function that semantically
takes no parameters with a nonzero number of arguments.

Previously, such code would still compile, but risk blowing up the stack
if a compiler chose to use something other than caller-cleanup calling
conventions.
This commit is contained in:
Tudor Brindus
2021-01-14 01:05:26 -05:00
committed by Geoffrey McRae
parent dc17492750
commit a46a3a2668
28 changed files with 111 additions and 111 deletions

View File

@@ -171,7 +171,7 @@ static enum LG_ClipboardData mimetypeToCbType(const char * mimetype)
return LG_CLIPBOARD_DATA_NONE;
}
static const char * wayland_cb_getName()
static const char * wayland_cb_getName(void)
{
return "Wayland";
}
@@ -327,7 +327,7 @@ static bool wayland_cb_init(
return true;
}
static void wayland_cb_free()
static void wayland_cb_free(void)
{
free(this);
this = NULL;
@@ -425,7 +425,7 @@ static void wayland_cb_notice(LG_ClipboardRequestFn requestFn,
this->requestFn(wayland_cb_reply_fn, NULL);
}
static void wayland_cb_release()
static void wayland_cb_release(void)
{
this->requestFn = NULL;
}

View File

@@ -57,7 +57,7 @@ static const char * atomTypes[] =
"image/jpeg"
};
static const char * x11_cb_getName()
static const char * x11_cb_getName(void)
{
return "X11";
}
@@ -116,7 +116,7 @@ static bool x11_cb_init(
return true;
}
static void x11_cb_free()
static void x11_cb_free(void)
{
free(this);
this = NULL;
@@ -432,7 +432,7 @@ static void x11_cb_notice(LG_ClipboardRequestFn requestFn, LG_ClipboardData type
XFlush(this->display);
}
static void x11_cb_release()
static void x11_cb_release(void)
{
this->requestFn = NULL;
XSetSelectionOwner(this->display, XA_PRIMARY , None, CurrentTime);

View File

@@ -150,4 +150,4 @@ struct LG_Font LGF_SDL =
.destroy = lgf_sdl_destroy,
.render = lgf_sdl_render,
.release = lgf_sdl_release
};
};

View File

@@ -158,12 +158,12 @@ static struct Option egl_options[] =
void update_mouse_shape(struct Inst * this);
const char * egl_get_name()
const char * egl_get_name(void)
{
return "EGL";
}
void egl_setup()
void egl_setup(void)
{
option_register(egl_options);
}

View File

@@ -268,7 +268,7 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_
return true;
}
static void egl_warn_slow()
static void egl_warn_slow(void)
{
static bool warnDone = false;
if (!warnDone)

View File

@@ -196,12 +196,12 @@ static bool draw_frame(struct Inst * this);
static void draw_mouse(struct Inst * this);
static void render_wait(struct Inst * this);
const char * opengl_get_name()
const char * opengl_get_name(void)
{
return "OpenGL";
}
static void opengl_setup()
static void opengl_setup(void)
{
option_register(opengl_options);
}

View File

@@ -396,7 +396,7 @@ static struct Option options[] =
{0}
};
void config_init()
void config_init(void)
{
params.center = true;
params.w = 1024;
@@ -514,12 +514,12 @@ bool config_load(int argc, char * argv[])
return true;
}
void config_free()
void config_free(void)
{
option_free();
}
static void doLicense()
static void doLicense(void)
{
fprintf(stderr,
"\n"

View File

@@ -38,7 +38,7 @@ struct ll
LG_Lock lock;
};
struct ll * ll_new()
struct ll * ll_new(void)
{
struct ll * list = malloc(sizeof(struct ll));
list->head = NULL;

View File

@@ -88,7 +88,7 @@ struct AppParams params = { 0 };
static void setGrab(bool enable);
static void setGrabQuiet(bool enable);
static void lgInit()
static void lgInit(void)
{
g_state.state = APP_STATE_RUNNING;
g_state.resizeDone = true;
@@ -101,13 +101,13 @@ static void lgInit()
g_cursor.guest.valid = false;
}
static bool inputEnabled()
static bool inputEnabled(void)
{
return params.useSpiceInput && !g_state.ignoreInput &&
((g_cursor.grab && params.captureInputOnly) || !params.captureInputOnly);
}
static void alignToGuest()
static void alignToGuest(void)
{
if (SDL_HasEvent(e_SDLEvent))
return;
@@ -120,7 +120,7 @@ static void alignToGuest()
SDL_PushEvent(&event);
}
static void updatePositionInfo()
static void updatePositionInfo(void)
{
if (g_state.haveSrcSize)
{
@@ -709,7 +709,7 @@ static SpiceDataType clipboard_type_to_spice_type(const LG_ClipboardData type)
}
}
void clipboardRelease()
void clipboardRelease(void)
{
if (!params.clipboardToVM)
return;
@@ -814,7 +814,7 @@ void spiceClipboardData(const SpiceDataType type, uint8_t * buffer, uint32_t siz
}
}
void spiceClipboardRelease()
void spiceClipboardRelease(void)
{
if (!params.clipboardToLocal)
return;
@@ -915,7 +915,7 @@ static void guestCurToLocal(struct DoublePoint *local)
// warp support. Instead, we attempt a best-effort emulation which works with a
// 1:1 mouse movement patch applied in the guest. For anything fancy, use
// capture mode.
static void handleMouseWayland()
static void handleMouseWayland(void)
{
if (g_cursor.guest.dpiScale == 0)
return;
@@ -1119,7 +1119,7 @@ static void handleResizeEvent(unsigned int w, unsigned int h)
}
}
static void handleWindowLeave()
static void handleWindowLeave(void)
{
g_cursor.inWindow = false;
g_cursor.inView = false;
@@ -1133,7 +1133,7 @@ static void handleWindowLeave()
g_cursor.redraw = true;
}
static void handleWindowEnter()
static void handleWindowEnter(void)
{
g_cursor.inWindow = true;
if (!inputEnabled())
@@ -1773,7 +1773,7 @@ static void key_passthrough(SDL_Scancode key, void * opaque)
spice_key_up (sc);
}
static void register_key_binds()
static void register_key_binds(void)
{
g_state.kbFS = app_register_keybind(SDL_SCANCODE_F , toggle_fullscreen, NULL);
g_state.kbVideo = app_register_keybind(SDL_SCANCODE_V , toggle_video , NULL);
@@ -1799,7 +1799,7 @@ static void register_key_binds()
g_state.kbPass[1] = app_register_keybind(SDL_SCANCODE_RGUI, key_passthrough, NULL);
}
static void release_key_binds()
static void release_key_binds(void)
{
app_release_keybind(&g_state.kbFS );
app_release_keybind(&g_state.kbVideo);
@@ -1813,7 +1813,7 @@ static void release_key_binds()
app_release_keybind(&g_state.kbPass[i]);
}
static void initSDLCursor()
static void initSDLCursor(void)
{
const uint8_t data[4] = {0xf, 0x9, 0x9, 0xf};
const uint8_t mask[4] = {0xf, 0xf, 0xf, 0xf};
@@ -1821,7 +1821,7 @@ static void initSDLCursor()
SDL_SetCursor(cursor);
}
static int lg_run()
static int lg_run(void)
{
memset(&g_state, 0, sizeof(g_state));
@@ -2218,7 +2218,7 @@ restart:
return 0;
}
static void lg_shutdown()
static void lg_shutdown(void)
{
g_state.state = APP_STATE_SHUTDOWN;
if (t_render)

View File

@@ -41,7 +41,7 @@ static void wmWaylandUngrabKeyboard();
static void wmWaylandGrabPointer();
static void wmWaylandUngrabPointer();
void wmInit()
void wmInit(void)
{
switch (g_state.wminfo.subsystem)
{
@@ -54,7 +54,7 @@ void wmInit()
}
}
void wmFree()
void wmFree(void)
{
switch (g_state.wminfo.subsystem)
{
@@ -67,7 +67,7 @@ void wmFree()
}
}
void wmGrabPointer()
void wmGrabPointer(void)
{
switch(g_state.wminfo.subsystem)
{
@@ -96,7 +96,7 @@ void wmGrabPointer()
g_wmState.pointerGrabbed = true;
}
void wmUngrabPointer()
void wmUngrabPointer(void)
{
switch(g_state.wminfo.subsystem)
{
@@ -116,7 +116,7 @@ void wmUngrabPointer()
g_wmState.pointerGrabbed = false;
}
void wmGrabKeyboard()
void wmGrabKeyboard(void)
{
switch(g_state.wminfo.subsystem)
{
@@ -151,7 +151,7 @@ void wmGrabKeyboard()
g_wmState.keyboardGrabbed = true;
}
void wmUngrabKeyboard()
void wmUngrabKeyboard(void)
{
switch(g_state.wminfo.subsystem)
{
@@ -174,13 +174,13 @@ void wmUngrabKeyboard()
g_wmState.keyboardGrabbed = false;
}
void wmGrabAll()
void wmGrabAll(void)
{
wmGrabPointer();
wmGrabKeyboard();
}
void wmUngrabAll()
void wmUngrabAll(void)
{
wmUngrabPointer();
wmUngrabKeyboard();
@@ -383,7 +383,7 @@ static const struct wl_seat_listener seatListener = {
.name = seatNameHandler,
};
void wmWaylandInit()
void wmWaylandInit(void)
{
struct WMDataWayland * wm = malloc(sizeof(struct WMDataWayland));
memset(wm, 0, sizeof(struct WMDataWayland));
@@ -418,7 +418,7 @@ static const struct zwp_relative_pointer_v1_listener relativePointerListener = {
.relative_motion = relativePointerMotionHandler,
};
static void wmWaylandGrabPointer()
static void wmWaylandGrabPointer(void)
{
struct WMDataWayland * wm = g_wmState.opaque;
@@ -439,7 +439,7 @@ static void wmWaylandGrabPointer()
}
}
static void wmWaylandUngrabPointer()
static void wmWaylandUngrabPointer(void)
{
struct WMDataWayland * wm = g_wmState.opaque;
@@ -456,7 +456,7 @@ static void wmWaylandUngrabPointer()
}
}
static void wmWaylandGrabKeyboard()
static void wmWaylandGrabKeyboard(void)
{
struct WMDataWayland * wm = g_wmState.opaque;
@@ -467,7 +467,7 @@ static void wmWaylandGrabKeyboard()
}
}
static void wmWaylandUngrabKeyboard()
static void wmWaylandUngrabKeyboard(void)
{
struct WMDataWayland * wm = g_wmState.opaque;
@@ -478,7 +478,7 @@ static void wmWaylandUngrabKeyboard()
}
}
static void wmWaylandFree()
static void wmWaylandFree(void)
{
struct WMDataWayland * wm = g_wmState.opaque;