[mw-devel] [Git][arthur/mw][master] Avoid troublesome test in replay.since code

Justin Mitchell arthur at sucs.org
Thu Sep 21 14:58:53 BST 2017


Justin Mitchell pushed to branch master at Justin Mitchell / mw


Commits:
5db90fca by Justin Mitchell at 2017-09-21T14:58:43+01:00
Avoid troublesome test in replay.since code

- - - - -


1 changed file:

- src/server/replay.c


Changes:

=====================================
src/server/replay.c
=====================================
--- a/src/server/replay.c
+++ b/src/server/replay.c
@@ -138,15 +138,13 @@ void replay(ipc_connection_t *conn, ipc_message_t *msg)
 	if (json_object_get(cmd, "since")!=NULL) {
 		/* everything after {unixtime} */
 		int64_t want = json_getint(cmd, "since");
-		int skip = 0;
-		while (oldest != store_next) {
+		while (len > 0) {
 			/* list will be in date order */
 			if (store[oldest]!=NULL &&
 				store[oldest]->head.when >= want) break;
-			skip++;
+			len--;
 			oldest = store_wrap(oldest + 1);
 		}
-		len -= skip;
 		/* if it fails you get nothing as there is
 		 * nothing newer (larger) than the date you gave */
 	}else



View it on GitLab: https://projects.sucs.org/arthur/mw/commit/5db90fcabd769405263300c60dcb8ebd0a89001a

---
View it on GitLab: https://projects.sucs.org/arthur/mw/commit/5db90fcabd769405263300c60dcb8ebd0a89001a
You're receiving this email because of your account on projects.sucs.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sucs.org/pipermail/mw-devel/attachments/20170921/ce220793/attachment.html>


More information about the mw-devel mailing list