--- 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);
|