OSSP CVS Repository

ossp - Difference in ossp-pkg/sio/al.c versions 1.16 and 1.17
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/sio/al.c 1.16 -> 1.17

--- al.c 2002/10/17 11:42:43     1.16
+++ al.c 2002/10/17 14:16:51     1.17
@@ -429,7 +429,11 @@
     size_t pos, end;
     size_t chunksize;
 
-    if (off >= 0) {
+    if (off < 0) /* off is negative */
+        off += al->bytes;
+
+    if ((al->bytes / 2) >= off) { /* FIXME poor man's heuristic */
+        /* forward search */
         pos = 0;
         FOREACH(al,chunks,cur) {
             chunksize = AL_CHUNK_LEN(cur);
@@ -450,7 +454,7 @@
             return AL_OK;
         }
     } else {
-        off += al->bytes;
+        /* reverse search */
         pos  = al->bytes;
         FOREACHR(al,chunks,cur) {
             chunksize = AL_CHUNK_LEN(cur);

CVSTrac 2.0.1