Fix some signed/unsigned misbehaviors; add FAQ
[srvx.git] / src / proto-common.c
index 3fcadd7b5c0b3f2fcd13ec3b26897e8f2e46f879..6a042edbaa22a79ca2b7bf6fd014e4237d8fca5e 100644 (file)
@@ -81,7 +81,8 @@ uplink_readable(struct io_fd *fd) {
         close_socket();
         return;
     }
-    if ((eol = strpbrk(buffer, "\r\n"))) *eol = 0;
+    if ((eol = strpbrk(buffer, "\r\n")))
+        *eol = 0;
     log_replay(MAIN_LOG, false, buffer);
     if (cManager.uplink->state != DISCONNECTED)
         parse_line(buffer, 0);
@@ -95,7 +96,8 @@ socket_destroyed(struct io_fd *fd)
         log_module(MAIN_LOG, LOG_ERROR, "Connection to server lost.");
     socket_io_fd = NULL;
     cManager.uplink->state = DISCONNECTED;
-    if (self->uplink) DelServer(self->uplink, 0, NULL);
+    if (self->uplink)
+        DelServer(self->uplink, 0, NULL);
 }
 
 void replay_event_loop(void)
@@ -635,8 +637,8 @@ mod_chanmode(struct userNode *who, struct chanNode *channel, char **modes, unsig
 int
 irc_make_chanmode(struct chanNode *chan, char *out) {
     struct mod_chanmode change;
+    mod_chanmode_init(&change);
     change.modes_set = chan->modes;
-    change.modes_clear = change.argc = 0;
     change.new_limit = chan->limit;
     safestrncpy(change.new_key, chan->key, sizeof(change.new_key));
     return strlen(mod_chanmode_format(&change, out));