libctdb: Reorder set_message_handler
authorVolker Lendecke <vl@samba.org>
Thu, 18 Aug 2011 11:55:24 +0000 (13:55 +0200)
committerMichael Adam <obnox@samba.org>
Mon, 22 Aug 2011 15:11:06 +0000 (17:11 +0200)
No code change, this is for better readability

Signed-off-by: Michael Adam <obnox@samba.org>
libctdb/messages.c

index d61d29e16f592cc0fa019279da59bd026dfb966d..737d2559402b7f939ffda43c6366e102b2897bda 100644 (file)
@@ -57,34 +57,7 @@ void remove_message_handlers(struct ctdb_connection *ctdb)
        }
 }
 
-bool ctdb_set_message_handler_recv(struct ctdb_connection *ctdb,
-                                  struct ctdb_request *req)
-{
-       struct message_handler_info *info = req->extra;
-       struct ctdb_reply_control *reply;
-
-       reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_REGISTER_SRVID);
-       if (!reply) {
-               return false;
-       }
-       if (reply->status != 0) {
-               DEBUG(ctdb, LOG_ERR,
-                     "ctdb_set_message_handler_recv: status %i",
-                     reply->status);
-               return false;
-       }
-
-       /* Put ourselves in list of handlers. */
-       DLIST_ADD(ctdb->message_handlers, info);
-       /* Keep safe from destructor */
-       req->extra = NULL;
-       return true;
-}
-
-static void free_info(struct ctdb_connection *ctdb, struct ctdb_request *req)
-{
-       free(req->extra);
-}
+static void free_info(struct ctdb_connection *ctdb, struct ctdb_request *req);
 
 struct ctdb_request *
 ctdb_set_message_handler_send(struct ctdb_connection *ctdb, uint64_t srvid,
@@ -124,6 +97,35 @@ ctdb_set_message_handler_send(struct ctdb_connection *ctdb, uint64_t srvid,
        return req;
 }
 
+static void free_info(struct ctdb_connection *ctdb, struct ctdb_request *req)
+{
+       free(req->extra);
+}
+
+bool ctdb_set_message_handler_recv(struct ctdb_connection *ctdb,
+                                  struct ctdb_request *req)
+{
+       struct message_handler_info *info = req->extra;
+       struct ctdb_reply_control *reply;
+
+       reply = unpack_reply_control(ctdb, req, CTDB_CONTROL_REGISTER_SRVID);
+       if (!reply) {
+               return false;
+       }
+       if (reply->status != 0) {
+               DEBUG(ctdb, LOG_ERR,
+                     "ctdb_set_message_handler_recv: status %i",
+                     reply->status);
+               return false;
+       }
+
+       /* Put ourselves in list of handlers. */
+       DLIST_ADD(ctdb->message_handlers, info);
+       /* Keep safe from destructor */
+       req->extra = NULL;
+       return true;
+}
+
 struct ctdb_request *
 ctdb_remove_message_handler_send(struct ctdb_connection *ctdb, uint64_t srvid,
                                 ctdb_message_fn_t handler, void *hdata,