OSSP CVS Repository

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

Check-in Number: 2922
Date: 2002-Nov-28 18:21:55 (local)
2002-Nov-28 17:21:55 (UTC)
User:mlelstv
Branch:
Comment: make al_setlabel conditional (use oldlabel == NULL for unconditional behavíour)

PR: Submitted by: Reviewed by: Approved by: Obtained from:

Tickets:
Inspections:
Files:
ossp-pkg/sio/al.c      1.38 -> 1.39     7 inserted, 4 deleted
ossp-pkg/sio/al.h      1.16 -> 1.17     1 inserted, 1 deleted
ossp-pkg/sio/al.pod      1.16 -> 1.17     4 inserted, 3 deleted

ossp-pkg/sio/al.c 1.38 -> 1.39

--- al.c 2002/11/28 16:11:49     1.38
+++ al.c 2002/11/28 17:21:55     1.39
@@ -821,7 +821,8 @@
  *
  */
 al_rc_t
-al_setlabel(al_t *al, size_t off, size_t n, al_label_t label)
+al_setlabel(al_t *al, size_t off, size_t n,
+            al_label_t oldlabel, al_label_t newlabel)
 {
     al_rc_t rc;
     al_chunk_t *cur, *splitbuf;
@@ -853,7 +854,8 @@
      * then split chunk at offset, continue
      * with second half
      */
-    if (AL_SAME_LABEL(cur, label)) {
+    if (!AL_SAME_LABEL(cur, oldlabel) ||
+        AL_SAME_LABEL(cur, newlabel)) {
         len = AL_CHUNK_LEN(cur) - skip;
         n = n < len ? 0 : n - len;
         cur = NEXT(cur, chunks);
@@ -876,7 +878,8 @@
      */
     while (n > 0 && cur != NULL) {
         len = AL_CHUNK_LEN(cur);
-        if (AL_SAME_LABEL(cur, label)) {
+        if (!AL_SAME_LABEL(cur, oldlabel) ||
+            AL_SAME_LABEL(cur, newlabel)) {
             n = n < len ? 0 : n - len;
         } else {
             if (n < len) {
@@ -890,7 +893,7 @@
                 cur = splitbuf;
                 len = AL_CHUNK_LEN(cur);
             }
-            AL_CHUNK_LABEL(cur) = label;
+            AL_CHUNK_LABEL(cur) = newlabel;
             n   -= len;
         }
         cur  = NEXT(cur, chunks);


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

--- al.h 2002/11/28 16:11:49     1.16
+++ al.h 2002/11/28 17:21:55     1.17
@@ -71,7 +71,7 @@
 al_rc_t al_traverse_cb  (al_t *al, size_t off, size_t n, al_td_t dir, al_label_t label, al_rc_t (*cb)(al_chunk_t *, void *), void *u);
 al_rc_t al_copy         (al_t *al, size_t off, size_t n, al_label_t label, al_t *tal);
 al_rc_t al_splice       (al_t *al, size_t off, size_t n, al_t *nal, al_t *tal);
-al_rc_t al_setlabel     (al_t *al, size_t off, size_t n, al_label_t label);
+al_rc_t al_setlabel     (al_t *al, size_t off, size_t n, al_label_t oldlabel, al_label_t newlabel);
 al_rc_t al_flatten      (al_t *al, size_t off, size_t n, al_td_t dir, al_label_t label, char *dst, size_t *lenp);
 al_rc_t al_firstlabel   (al_t *al, size_t off, size_t n, al_td_t dir, al_label_t label, al_label_t *labelp);
 al_rc_t al_spanlabel    (al_t *al, size_t off, size_t n, al_label_t label, size_t *offp, size_t *spanp);


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

--- al.pod       2002/11/28 16:11:49     1.16
+++ al.pod       2002/11/28 17:21:55     1.17
@@ -272,11 +272,12 @@
 The buffer now holds the string "HelloGoodbye\n".
 The insertion is empty.
 
-=item al_rc_t B<al_setlabel>(al_t *I<al>, size_t I<off>, size_t I<n>, al_label_t *label);
+=item al_rc_t B<al_setlabel>(al_t *I<al>, size_t I<off>, size_t I<n>, al_label_t oldlabel, al_label_t newlabel);
 
 I<off> and I<n> are byte counts that define a span of bytes within the
-source assembly line I<al>. These bytes are tagged with I<label>, any
-existing label for these bytes is overwritten.
+source assembly line I<al>. The bytes within that span that match I<oldlabel>
+are tagged with I<newlabel>, any existing labels for these bytes are
+overwritten.
 
 =item size_t B<al_bytes>(const al_t *I<al>);
 

CVSTrac 2.0.1