]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Move setting of data->incoreoffset[entry]
authorMichael Schroeder <mls@suse.de>
Fri, 11 Dec 2015 11:08:36 +0000 (12:08 +0100)
committerMichael Schroeder <mls@suse.de>
Fri, 11 Dec 2015 11:08:36 +0000 (12:08 +0100)
We need the old value when we copy the complete old entry

src/repodata.c

index c005b7a8a5ebf39acc4edc53d8f477631bfa40f7..ad3e71a2d81126ee6f8fe5910d9c6c2fbed9280e 100644 (file)
@@ -3411,19 +3411,19 @@ fprintf(stderr, "schemadata %p\n", data->schemadata);
            }
        }
 
-      /* Now create data blob.  We walk through the (possibly new) schema
-        and either copy over old data, or insert the new.  */
-      if (entry >= 0)
-        data->incoreoffset[entry] = newincore.len;
-
+      /* just copy over the complete old entry (including the schemaid) if there was no new data */
       if (entry >= 0 && !neednewschema && oldschemaid && (!data->attrs || !data->attrs[entry]) && dp)
        {
-         /* just copy over the complete old entry (including the schemaid) */
          ndp = data->incoredata + data->incoreoffset[entry];
+         data->incoreoffset[entry] = newincore.len;
          data_addblob(&newincore, ndp, dp - ndp);
          goto entrydone;
        }
 
+      /* Now create data blob.  We walk through the (possibly new) schema
+        and either copy over old data, or insert the new.  */
+      if (entry >= 0)
+        data->incoreoffset[entry] = newincore.len;
       data_addid(&newincore, schemaid);
 
       /* we don't use a pointer to the schemadata here as repodata_serialize_key