add a section about pointer validity
[platform/upstream/libsolv.git] / doc / libsolv.txt
1 Libsolv(3)
2 ==========
3 :man manual: LIBSOLV
4 :man source: libsolv
5
6
7 Name
8 ----
9 libsolv - package dependency solver library using a satisfiability algorithm
10
11
12 Documentation
13 -------------
14 The libsolv documentation is split into multiple parts:
15
16 *libsolv-history*::
17   how the libsolv library came into existence
18
19 *libsolv-constantids*::
20   fixed Ids for often used strings
21
22 *libsolv-bindings*::
23   access libsolv from perl/python/ruby
24
25
26 Pointer Validity
27 ----------------
28 Note that all pointers to objects that have an Id have only a limited
29 validity period, with the exception of Repo pointers. There are only
30 guaranteed to be valid until a new object of that type is added or an
31 object of that type is removed. Thus pointers to Solvable objects are only 
32 valid until another solvable is created, because adding a Solvable may
33 relocate the Pool's Solvable array. This is also true for Pool strings,
34 you should use solv_strdup() to create a copy of the string if you
35 want to use it at some later time. You should use the Ids in the code
36 and not the pointers, except for short times where you know that the
37 pointer is safe.
38
39 Note also that the data lookup functions or the dataiterator also
40 return values with limited lifetime, this is especially true for data
41 stored in the paged data segment of solv files. This is normally
42 data that consists of big strings like package descriptions or is not
43 often needed like package checksums. Thus looking up a description of
44 a solvable and then looking up the description of a different solvable
45 or even the checksum of the same solvable may invalidate the first
46 result. (The dataiterator supports a dataiterator_strdup() function
47 to create a safe copy.)
48
49 The language bindings already deal with pointer validity, so you do
50 not have to worry about this issue when using the bindings.
51
52
53 Author
54 ------
55 Michael Schroeder <mls@suse.de>
56