Bump liberty

This commit is contained in:
Přemysl Eric Janouch 2017-06-22 23:23:57 +02:00
parent 93b305e35b
commit d37a38c100
Signed by: p
GPG Key ID: B715679E3A361BE6
3 changed files with 17 additions and 26 deletions

View File

@ -4,8 +4,8 @@ cmake_minimum_required (VERSION 2.8.5)
# Moar warnings # Moar warnings
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC) if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
# -Wunused-function is pretty annoying here, as everything is static # -Wunused-function is pretty annoying here, as everything is static
set (CMAKE_C_FLAGS set (wdisabled "-Wno-unused-function -Wno-implicit-fallthrough")
"${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra -Wno-unused-function") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra ${wdisabled}")
endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC) endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD") if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")

View File

@ -122,8 +122,8 @@ app_init (struct app_context *self)
memset (self, 0, sizeof *self); memset (self, 0, sizeof *self);
self->server_fd = -1; self->server_fd = -1;
self->listen_fd = -1; self->listen_fd = -1;
msg_reader_init (&self->msg_reader); self->msg_reader = msg_reader_make ();
write_queue_init (&self->write_queue); self->write_queue = write_queue_make ();
} }
static void static void
@ -217,8 +217,7 @@ flush_writer_to_server (struct msg_writer *writer, struct app_context *app)
static void static void
send_draw_point_response (struct client *client, int x, int y, uint8_t color) send_draw_point_response (struct client *client, int x, int y, uint8_t color)
{ {
struct msg_writer writer; struct msg_writer writer = msg_writer_make ();
msg_writer_init (&writer);
str_pack_u8 (&writer.buf, MESSAGE_PUT_POINT); str_pack_u8 (&writer.buf, MESSAGE_PUT_POINT);
str_pack_i32 (&writer.buf, x); str_pack_i32 (&writer.buf, x);
str_pack_i32 (&writer.buf, y); str_pack_i32 (&writer.buf, y);
@ -230,8 +229,7 @@ send_draw_point_response (struct client *client, int x, int y, uint8_t color)
static void static void
send_draw_point_request (struct app_context *app, int x, int y, uint8_t color) send_draw_point_request (struct app_context *app, int x, int y, uint8_t color)
{ {
struct msg_writer writer; struct msg_writer writer = msg_writer_make ();
msg_writer_init (&writer);
str_pack_u8 (&writer.buf, MESSAGE_PUT_POINT); str_pack_u8 (&writer.buf, MESSAGE_PUT_POINT);
str_pack_i32 (&writer.buf, x); str_pack_i32 (&writer.buf, x);
str_pack_i32 (&writer.buf, y); str_pack_i32 (&writer.buf, y);
@ -243,8 +241,7 @@ send_draw_point_request (struct app_context *app, int x, int y, uint8_t color)
static void static void
send_hello_request (struct app_context *app) send_hello_request (struct app_context *app)
{ {
struct msg_writer writer; struct msg_writer writer = msg_writer_make ();
msg_writer_init (&writer);
str_pack_u8 (&writer.buf, MESSAGE_HELLO); str_pack_u8 (&writer.buf, MESSAGE_HELLO);
str_pack_u8 (&writer.buf, PROTOCOL_VERSION); str_pack_u8 (&writer.buf, PROTOCOL_VERSION);
@ -254,8 +251,7 @@ send_hello_request (struct app_context *app)
static void static void
send_hello_response (struct client *client) send_hello_response (struct client *client)
{ {
struct msg_writer writer; struct msg_writer writer = msg_writer_make ();
msg_writer_init (&writer);
str_pack_u8 (&writer.buf, MESSAGE_HELLO); str_pack_u8 (&writer.buf, MESSAGE_HELLO);
str_pack_u8 (&writer.buf, PROTOCOL_VERSION); str_pack_u8 (&writer.buf, PROTOCOL_VERSION);
@ -265,8 +261,7 @@ send_hello_response (struct client *client)
static void static void
send_get_bitmap_request (struct app_context *app) send_get_bitmap_request (struct app_context *app)
{ {
struct msg_writer writer; struct msg_writer writer = msg_writer_make ();
msg_writer_init (&writer);
str_pack_u8 (&writer.buf, MESSAGE_GET_BITMAP); str_pack_u8 (&writer.buf, MESSAGE_GET_BITMAP);
flush_writer_to_server (&writer, app); flush_writer_to_server (&writer, app);
@ -275,8 +270,7 @@ send_get_bitmap_request (struct app_context *app)
static void static void
send_get_bitmap_response (struct client *client, struct app_context *app) send_get_bitmap_response (struct client *client, struct app_context *app)
{ {
struct msg_writer writer; struct msg_writer writer = msg_writer_make ();
msg_writer_init (&writer);
str_pack_u8 (&writer.buf, MESSAGE_GET_BITMAP); str_pack_u8 (&writer.buf, MESSAGE_GET_BITMAP);
str_pack_i32 (&writer.buf, app->bitmap_x); str_pack_i32 (&writer.buf, app->bitmap_x);
str_pack_i32 (&writer.buf, app->bitmap_y); str_pack_i32 (&writer.buf, app->bitmap_y);
@ -1043,7 +1037,7 @@ static void
on_server_disconnected (struct app_context *app) on_server_disconnected (struct app_context *app)
{ {
write_queue_free (&app->write_queue); write_queue_free (&app->write_queue);
write_queue_init (&app->write_queue); app->write_queue = write_queue_make ();
ev_io_stop (EV_DEFAULT_ &app->server_read_watcher); ev_io_stop (EV_DEFAULT_ &app->server_read_watcher);
ev_io_stop (EV_DEFAULT_ &app->server_write_watcher); ev_io_stop (EV_DEFAULT_ &app->server_write_watcher);
@ -1148,8 +1142,7 @@ on_server_data (EV_P_ ev_io *watcher, const void *buf, ssize_t n_read)
size_t len; size_t len;
while ((msg = msg_reader_get (&app->msg_reader, &len))) while ((msg = msg_reader_get (&app->msg_reader, &len)))
{ {
struct msg_unpacker unpacker; struct msg_unpacker unpacker = msg_unpacker_make (msg, len);
msg_unpacker_init (&unpacker, msg, len);
uint8_t type; uint8_t type;
if (!msg_unpacker_u8 (&unpacker, &type) if (!msg_unpacker_u8 (&unpacker, &type)
@ -1265,8 +1258,7 @@ on_client_data (EV_P_ ev_io *watcher, const void *buf, ssize_t n_read)
size_t len; size_t len;
while ((msg = msg_reader_get (&client->msg_reader, &len))) while ((msg = msg_reader_get (&client->msg_reader, &len)))
{ {
struct msg_unpacker unpacker; struct msg_unpacker unpacker = msg_unpacker_make (msg, len);
msg_unpacker_init (&unpacker, msg, len);
uint8_t type; uint8_t type;
if (!msg_unpacker_u8 (&unpacker, &type)) if (!msg_unpacker_u8 (&unpacker, &type))
@ -1328,8 +1320,8 @@ on_new_client (EV_P_ ev_io *watcher, int revents)
struct client *client = xcalloc (1, sizeof *client); struct client *client = xcalloc (1, sizeof *client);
client->fd = sock_fd; client->fd = sock_fd;
msg_reader_init (&client->msg_reader); client->msg_reader = msg_reader_make ();
write_queue_init (&client->write_queue); client->write_queue = write_queue_make ();
set_blocking (sock_fd, false); set_blocking (sock_fd, false);
ev_io_init (&client->read_watcher, on_client_ready, sock_fd, EV_READ); ev_io_init (&client->read_watcher, on_client_ready, sock_fd, EV_READ);
@ -1423,8 +1415,7 @@ parse_program_arguments (struct app_options *options, int argc, char **argv)
{ 0, NULL, NULL, 0, NULL } { 0, NULL, NULL, 0, NULL }
}; };
struct opt_handler oh; struct opt_handler oh = opt_handler_make (argc, argv, opts,
opt_handler_init (&oh, argc, argv, opts,
NULL, "Terminal drawing for NEET autists^Wartists"); NULL, "Terminal drawing for NEET autists^Wartists");
int c; int c;

@ -1 +1 @@
Subproject commit ec128558a4d067f51cd36d8026e6df849ea7de26 Subproject commit 3835b6e49975039a9f72b8920238f3141e7becea