OSSP CVS Repository

ossp - Check-in [2603]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2603
Date: 2002-Oct-17 16:16:51 (local)
2002-Oct-17 14:16:51 (UTC)
User:thl
Branch:
Comment: decouple pos/neg. offset handling from search direction decision
Tickets:
Inspections:
Files:
ossp-pkg/sio/al.c      1.16 -> 1.17     6 inserted, 2 deleted

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