summaryrefslogtreecommitdiff
path: root/src/dataiterator.h
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2013-03-06 15:42:26 +0100
committerMichael Schroeder <mls@suse.de>2013-03-06 15:42:26 +0100
commit6f2fdbc28eac5f1aa8819242c6506bc3bffb7ebe (patch)
tree21b1ccb478f92b1156f9f15a0a20e2010a57aaae /src/dataiterator.h
parent466ca05eda763db16f2b366038d899e78e3bfefb (diff)
downloadlibsolv-6f2fdbc28eac5f1aa8819242c6506bc3bffb7ebe.tar.gz
libsolv-6f2fdbc28eac5f1aa8819242c6506bc3bffb7ebe.tar.bz2
libsolv-6f2fdbc28eac5f1aa8819242c6506bc3bffb7ebe.zip
fix dataiterator returning random data in some cases
Fixed two issues: 1) iterating over attributes in with vertical storage could return junk when some other operation paged in some other data. 2) the returned string could also be in the paged area, or also in tmpspace if stringification was done. We can't simply alloc memory as this makes things slower, but in most cases the storage does not matter. So we offer a new function, dataiterator_strdup(), that makes the kv.str pointer persistent. WARNING: this commit is an ABI change as it changes the dataiterator structure. Sorry.
Diffstat (limited to 'src/dataiterator.h')
-rw-r--r--src/dataiterator.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dataiterator.h b/src/dataiterator.h
index 6f8fd32..a77d902 100644
--- a/src/dataiterator.h
+++ b/src/dataiterator.h
@@ -132,6 +132,16 @@ typedef struct _Dataiterator
} parents[3];
int nparents;
+ /* vertical data */
+ unsigned char *vert_ddp;
+ Id vert_off;
+ Id vert_len;
+ Id vert_storestate;
+
+ /* strdup data */
+ char *dupstr;
+ int dupstrn;
+
} Dataiterator;
@@ -165,6 +175,7 @@ void dataiterator_jump_to_repo(Dataiterator *di, struct _Repo *repo);
void dataiterator_entersub(Dataiterator *di);
void dataiterator_clonepos(Dataiterator *di, Dataiterator *from);
void dataiterator_seek(Dataiterator *di, int whence);
+void dataiterator_strdup(Dataiterator *di);
#define DI_SEEK_STAY (1 << 16)
#define DI_SEEK_CHILD 1