aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-06-22 23:23:57 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2017-06-22 23:23:57 +0200
commitd37a38c1004352bb726b0afe03fbabe750eec081 (patch)
treeb2a3b618d6b5117fe1a12983387fbb0f2a23742c
parent93b305e35b9d45d717d15b0222b98641a56ad944 (diff)
downloadautistdraw-d37a38c1004352bb726b0afe03fbabe750eec081.tar.gz
autistdraw-d37a38c1004352bb726b0afe03fbabe750eec081.tar.xz
autistdraw-d37a38c1004352bb726b0afe03fbabe750eec081.zip
Bump liberty
-rw-r--r--CMakeLists.txt4
-rw-r--r--autistdraw.c37
m---------liberty0
3 files changed, 16 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c37495b..cbb7583 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,8 +4,8 @@ cmake_minimum_required (VERSION 2.8.5)
# Moar warnings
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
# -Wunused-function is pretty annoying here, as everything is static
- set (CMAKE_C_FLAGS
- "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra -Wno-unused-function")
+ set (wdisabled "-Wno-unused-function -Wno-implicit-fallthrough")
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra ${wdisabled}")
endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")
diff --git a/autistdraw.c b/autistdraw.c
index 5e5655b..a215fb6 100644
--- a/autistdraw.c
+++ b/autistdraw.c
@@ -122,8 +122,8 @@ app_init (struct app_context *self)
memset (self, 0, sizeof *self);
self->server_fd = -1;
self->listen_fd = -1;
- msg_reader_init (&self->msg_reader);
- write_queue_init (&self->write_queue);
+ self->msg_reader = msg_reader_make ();
+ self->write_queue = write_queue_make ();
}
static void
@@ -217,8 +217,7 @@ flush_writer_to_server (struct msg_writer *writer, struct app_context *app)
static void
send_draw_point_response (struct client *client, int x, int y, uint8_t color)
{
- struct msg_writer writer;
- msg_writer_init (&writer);
+ struct msg_writer writer = msg_writer_make ();
str_pack_u8 (&writer.buf, MESSAGE_PUT_POINT);
str_pack_i32 (&writer.buf, x);
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
send_draw_point_request (struct app_context *app, int x, int y, uint8_t color)
{
- struct msg_writer writer;
- msg_writer_init (&writer);
+ struct msg_writer writer = msg_writer_make ();
str_pack_u8 (&writer.buf, MESSAGE_PUT_POINT);
str_pack_i32 (&writer.buf, x);
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
send_hello_request (struct app_context *app)
{
- struct msg_writer writer;
- msg_writer_init (&writer);
+ struct msg_writer writer = msg_writer_make ();
str_pack_u8 (&writer.buf, MESSAGE_HELLO);
str_pack_u8 (&writer.buf, PROTOCOL_VERSION);
@@ -254,8 +251,7 @@ send_hello_request (struct app_context *app)
static void
send_hello_response (struct client *client)
{
- struct msg_writer writer;
- msg_writer_init (&writer);
+ struct msg_writer writer = msg_writer_make ();
str_pack_u8 (&writer.buf, MESSAGE_HELLO);
str_pack_u8 (&writer.buf, PROTOCOL_VERSION);
@@ -265,8 +261,7 @@ send_hello_response (struct client *client)
static void
send_get_bitmap_request (struct app_context *app)
{
- struct msg_writer writer;
- msg_writer_init (&writer);
+ struct msg_writer writer = msg_writer_make ();
str_pack_u8 (&writer.buf, MESSAGE_GET_BITMAP);
flush_writer_to_server (&writer, app);
@@ -275,8 +270,7 @@ send_get_bitmap_request (struct app_context *app)
static void
send_get_bitmap_response (struct client *client, struct app_context *app)
{
- struct msg_writer writer;
- msg_writer_init (&writer);
+ struct msg_writer writer = msg_writer_make ();
str_pack_u8 (&writer.buf, MESSAGE_GET_BITMAP);
str_pack_i32 (&writer.buf, app->bitmap_x);
str_pack_i32 (&writer.buf, app->bitmap_y);
@@ -1043,7 +1037,7 @@ static void
on_server_disconnected (struct app_context *app)
{
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_write_watcher);
@@ -1148,8 +1142,7 @@ on_server_data (EV_P_ ev_io *watcher, const void *buf, ssize_t n_read)
size_t len;
while ((msg = msg_reader_get (&app->msg_reader, &len)))
{
- struct msg_unpacker unpacker;
- msg_unpacker_init (&unpacker, msg, len);
+ struct msg_unpacker unpacker = msg_unpacker_make (msg, len);
uint8_t 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;
while ((msg = msg_reader_get (&client->msg_reader, &len)))
{
- struct msg_unpacker unpacker;
- msg_unpacker_init (&unpacker, msg, len);
+ struct msg_unpacker unpacker = msg_unpacker_make (msg, len);
uint8_t 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);
client->fd = sock_fd;
- msg_reader_init (&client->msg_reader);
- write_queue_init (&client->write_queue);
+ client->msg_reader = msg_reader_make ();
+ client->write_queue = write_queue_make ();
set_blocking (sock_fd, false);
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 }
};
- struct opt_handler oh;
- opt_handler_init (&oh, argc, argv, opts,
+ struct opt_handler oh = opt_handler_make (argc, argv, opts,
NULL, "Terminal drawing for NEET autists^Wartists");
int c;
diff --git a/liberty b/liberty
-Subproject ec128558a4d067f51cd36d8026e6df849ea7de2
+Subproject 3835b6e49975039a9f72b8920238f3141e7bece