1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 21:53:05 +01:00

Fix unused variable warnings and change all (void)s to UNUSED macro

This commit is contained in:
jfreegman 2020-03-30 12:56:42 -04:00
parent 46513017e3
commit ddc8c53abf
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
9 changed files with 32 additions and 14 deletions

View File

@ -28,6 +28,7 @@
#include "line_info.h" #include "line_info.h"
#include "settings.h" #include "settings.h"
#include "misc_tools.h"
#include <AL/al.h> #include <AL/al.h>
#include <AL/alc.h> #include <AL/alc.h>
@ -456,7 +457,7 @@ void *thread_poll(void *arg) // TODO: maybe use thread for every input source
/* /*
* NOTE: We only need to poll input devices for data. * NOTE: We only need to poll input devices for data.
*/ */
(void)arg; UNUSED_VAR(arg);
uint32_t i; uint32_t i;
int32_t sample = 0; int32_t sample = 0;

View File

@ -901,7 +901,7 @@ static void init_infobox(ToxWindow *self)
return; return;
} }
(void) y2; UNUSED_VAR(y2);
memset(&ctx->infobox, 0, sizeof(struct infobox)); memset(&ctx->infobox, 0, sizeof(struct infobox));
@ -1011,6 +1011,8 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
getyx(self->window, y, x); getyx(self->window, y, x);
getmaxyx(self->window, y2, x2); getmaxyx(self->window, y2, x2);
UNUSED_VAR(y);
if (y2 <= 0 || x2 <= 0) { if (y2 <= 0 || x2 <= 0) {
return; return;
} }
@ -1239,7 +1241,9 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
int y, x; int y, x;
getyx(self->window, y, x); getyx(self->window, y, x);
(void) x;
UNUSED_VAR(x);
int new_x = ctx->start ? x2 - 1 : MAX(0, wcswidth(ctx->line, ctx->pos)); int new_x = ctx->start ? x2 - 1 : MAX(0, wcswidth(ctx->line, ctx->pos));
wmove(self->window, y + 1, new_x); wmove(self->window, y + 1, new_x);

View File

@ -488,6 +488,8 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
getyx(self->window, y, x); getyx(self->window, y, x);
getmaxyx(self->window, y2, x2); getmaxyx(self->window, y2, x2);
UNUSED_VAR(y);
if (x2 <= 0 || y2 <= 0) { if (x2 <= 0 || y2 <= 0) {
return; return;
} }
@ -666,7 +668,9 @@ static void groupchat_onDraw(ToxWindow *self, Tox *m)
int y, x; int y, x;
getyx(self->window, y, x); getyx(self->window, y, x);
(void) x;
UNUSED_VAR(x);
int new_x = ctx->start ? x2 - 1 : MAX(0, wcswidth(ctx->line, ctx->pos)); int new_x = ctx->start ? x2 - 1 : MAX(0, wcswidth(ctx->line, ctx->pos));
wmove(self->window, y + 1, new_x); wmove(self->window, y + 1, new_x);

View File

@ -138,7 +138,8 @@ static void help_draw_bottom_menu(WINDOW *win)
{ {
int y2, x2; int y2, x2;
getmaxyx(win, y2, x2); getmaxyx(win, y2, x2);
(void) x2;
UNUSED_VAR(x2);
wmove(win, y2 - 2, 1); wmove(win, y2 - 2, 1);

View File

@ -270,7 +270,8 @@ static void line_info_check_queue(ToxWindow *self)
int y, y2, x, x2; int y, y2, x, x2;
getmaxyx(self->window, y2, x2); getmaxyx(self->window, y2, x2);
getyx(self->chatwin->history, y, x); getyx(self->chatwin->history, y, x);
(void) x;
UNUSED_VAR(x);
if (x2 <= SIDEBAR_WIDTH) { if (x2 <= SIDEBAR_WIDTH) {
return; return;
@ -567,7 +568,9 @@ static void line_info_page_up(ToxWindow *self, struct history *hst)
{ {
int x2, y2; int x2, y2;
getmaxyx(self->window, y2, x2); getmaxyx(self->window, y2, x2);
(void) x2;
UNUSED_VAR(x2);
int jump_dist = y2 / 2; int jump_dist = y2 / 2;
int i; int i;
@ -580,7 +583,9 @@ static void line_info_page_down(ToxWindow *self, struct history *hst)
{ {
int x2, y2; int x2, y2;
getmaxyx(self->window, y2, x2); getmaxyx(self->window, y2, x2);
(void) x2;
UNUSED_VAR(x2);
int jump_dist = y2 / 2; int jump_dist = y2 / 2;
int i; int i;

View File

@ -235,7 +235,7 @@ void graceful_clear(void)
void *do_playing(void *_p) void *do_playing(void *_p)
{ {
(void)_p; UNUSED_VAR(_p);
while (true) { while (true) {
control_lock(); control_lock();
@ -334,7 +334,7 @@ int play_source(uint32_t source, uint32_t buffer, bool looping)
#elif BOX_NOTIFY #elif BOX_NOTIFY
void *do_playing(void *_p) void *do_playing(void *_p)
{ {
(void)_p; UNUSED_VAR(_p);
while (true) { while (true) {
control_lock(); control_lock();

View File

@ -220,6 +220,8 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
getyx(self->window, y, x); getyx(self->window, y, x);
getmaxyx(self->window, y2, x2); getmaxyx(self->window, y2, x2);
UNUSED_VAR(y);
if (x2 <= 0 || y2 <= 0) { if (x2 <= 0 || y2 <= 0) {
return; return;
} }
@ -416,7 +418,8 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
int y, x; int y, x;
getyx(self->window, y, x); getyx(self->window, y, x);
(void) x;
UNUSED_VAR(x);
int new_x = ctx->start ? x2 - 1 : MAX(0, wcswidth(ctx->line, ctx->pos)); int new_x = ctx->start ? x2 - 1 : MAX(0, wcswidth(ctx->line, ctx->pos));
wmove(self->window, y + 1, new_x); wmove(self->window, y + 1, new_x);
@ -508,7 +511,7 @@ void prompt_init_statusbar(ToxWindow *self, Tox *m, bool first_time_run)
exit_toxic_err("failed in prompt_init_statusbar", FATALERR_CURSES); exit_toxic_err("failed in prompt_init_statusbar", FATALERR_CURSES);
} }
(void) y2; UNUSED_VAR(y2);
/* Init statusbar info */ /* Init statusbar info */
StatusBar *statusbar = self->stb; StatusBar *statusbar = self->stb;

View File

@ -662,7 +662,7 @@ void *video_thread_poll(void *arg) // TODO: maybe use thread for every input so
/* /*
* NOTE: We only need to poll input devices for data. * NOTE: We only need to poll input devices for data.
*/ */
(void)arg; UNUSED_VAR(arg);
uint32_t i; uint32_t i;
while (1) { while (1) {

View File

@ -232,7 +232,7 @@ void *event_loop(void *p)
{ {
/* Handle events like a real nigga */ /* Handle events like a real nigga */
(void) p; /* DINDUNOTHIN */ UNUSED_VAR(p); /* DINDUNOTHIN */
XEvent event; XEvent event;
int pending; int pending;