diff options
Diffstat (limited to '')
-rw-r--r-- | src/mds-registry/registry.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mds-registry/registry.c b/src/mds-registry/registry.c index 0c4d5a5..3b00834 100644 --- a/src/mds-registry/registry.c +++ b/src/mds-registry/registry.c @@ -1,6 +1,6 @@ /** * mds — A micro-display server - * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se) + * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,7 +72,7 @@ handle_close_message(void) /* Remove server for all protocols. */ for (i = 0; i < received.header_count; i++) { - if (startswith(received.headers[i], "Client closed: ")) { + if (strstarts(received.headers[i], "Client closed: ")) { client = parse_client_id(received.headers[i] + strlen("Client closed: ")); foreach_hash_table_entry (reg_table, j, entry) { @@ -409,7 +409,7 @@ handle_register_message(void) size_t i, length = 0; #define __get_header(storage, header)\ - (startswith(received.headers[i], header))\ + (strstarts(received.headers[i], header))\ storage = received.headers[i] + strlen(header) for (i = 0; i < received.header_count; i++) { @@ -428,11 +428,11 @@ handle_register_message(void) #undef __get_header /* Validate headers. */ - if (!recv_client_id || strequals(recv_client_id, "0:0")) + if (!recv_client_id || streq(recv_client_id, "0:0")) return eprint("received message from anonymous sender, ignoring."), 0; else if (!strchr(recv_client_id, ':')) return eprint("received message from sender without a colon it its ID, ignoring, invalid ID."), 0; - else if (!recv_length && (!recv_action || !strequals(recv_action, "list"))) + else if (!recv_length && (!recv_action || !streq(recv_action, "list"))) return eprint("received empty message without `Action: list`, ignoring, has no effect."), 0; else if (!recv_message_id) return eprint("received message without ID, ignoring, master server is misbehaving."), 0; @@ -446,10 +446,10 @@ handle_register_message(void) /* Perform action. */ #define __registry_action(action) registry_action(length, action, recv_client_id, recv_message_id) - if (strequals(recv_action, "add")) return __registry_action(1); - else if (strequals(recv_action, "remove")) return __registry_action(-1); - else if (strequals(recv_action, "wait")) return __registry_action(0); - else if (strequals(recv_action, "list")) return list_registry(recv_client_id, recv_message_id); + if (streq(recv_action, "add")) return __registry_action(1); + else if (streq(recv_action, "remove")) return __registry_action(-1); + else if (streq(recv_action, "wait")) return __registry_action(0); + else if (streq(recv_action, "list")) return list_registry(recv_client_id, recv_message_id); else { eprint("received invalid action, ignoring."); return 0; @@ -470,7 +470,7 @@ handle_message(void) { size_t i; for (i = 0; i < received.header_count; i++) { - if (strequals(received.headers[i], "Command: register")) { + if (streq(received.headers[i], "Command: register")) { fail_if (handle_register_message()); return 0; } |