MINOR: server: use functions to detect state changes and to update them

Detecting that a server's status has changed is a bit messy, as well
as it is to commit the status changes. We'll have to add new conditions
soon and we'd better avoid to multiply the number of touched locations
with the high risk of forgetting them.

This commit introduces :
  - srv_lb_status_changed() to report if the status changed from the
    previously committed one ;
  - svr_lb_commit_status() to commit the current status

The function is now used by all load-balancing algorithms.
diff --git a/include/proto/backend.h b/include/proto/backend.h
index 68ba3d6..7af92e2 100644
--- a/include/proto/backend.h
+++ b/include/proto/backend.h
@@ -66,6 +66,24 @@
 	return 1;
 }
 
+/* This function commits the current server state and weight onto the previous
+ * ones in order to detect future changes.
+ */
+static inline void srv_lb_commit_status(struct server *srv)
+{
+	srv->prev_state = srv->state;
+	srv->prev_eweight = srv->eweight;
+}
+
+/* This function returns true when a server has experienced a change since last
+ * commit on its state or weight, otherwise zero.
+ */
+static inline int srv_lb_status_changed(const struct server *srv)
+{
+	return (srv->state != srv->prev_state ||
+		srv->eweight != srv->prev_eweight);
+}
+
 #endif /* _PROTO_BACKEND_H */
 
 /*