]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
add pool_solvable2id() 274/head
authorIgor Gnatenko <i.gnatenko.brain@gmail.com>
Wed, 27 Jun 2018 16:27:07 +0000 (18:27 +0200)
committerIgor Gnatenko <i.gnatenko.brain@gmail.com>
Mon, 2 Jul 2018 09:19:35 +0000 (10:19 +0100)
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
doc/gen/libsolv-pool.3
doc/libsolv-pool.txt
src/pool.h

index ffb8e56cd00f8353662d94459e2a9eb824c4725d..c0e14278cd9f74e82c08aa2146f4767a0217742c 100644 (file)
@@ -7,7 +7,7 @@
 .\"    Source: libsolv
 .\"  Language: English
 .\"
-.TH "LIBSOLV\-POOL" "3" "01/18/2018" "libsolv" "LIBSOLV"
+.TH "LIBSOLV\-POOL" "3" "06/27/2018" "libsolv" "LIBSOLV"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -764,6 +764,18 @@ Convert a solvable Id into a pointer to the solvable data\&. Note that the point
 .RS 4
 .\}
 .nf
+\fBId pool_solvable2id(const Pool *\fR\fIpool\fR\fB, Solvable *\fR\fIs\fR\fB)\fR;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Convert a pointer to the solvable data into a solvable Id\&.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
 \fBconst char *pool_solvid2str(Pool *\fR\fIpool\fR\fB, Id\fR \fIp\fR\fB)\fR;
 .fi
 .if n \{\
index 60147207b7ca7c7f826244adcec137b9bb3c2e35..0b9bc411b4f213f76b3e15dfb1feb86039bed20b 100644 (file)
@@ -499,6 +499,10 @@ Convert a solvable Id into a pointer to the solvable data. Note that the
 pointer may become invalid if new solvables are created or old solvables
 deleted, because the array storing all solvables may get reallocated.
 
+       Id pool_solvable2id(const Pool *pool, Solvable *s);
+
+Convert a pointer to the solvable data into a solvable Id.
+
        const char *pool_solvid2str(Pool *pool, Id p);
 
 Return a string representing the solvable with the Id _p_. The string will
index f6573af38fa01119ca85241abc9a74ea01985f16..378051b4f30c429d945ecc02f5ab0c145a28de03 100644 (file)
@@ -282,6 +282,10 @@ static inline Solvable *pool_id2solvable(const Pool *pool, Id p)
 {
   return pool->solvables + p;
 }
+static inline Id pool_solvable2id(const Pool *pool, Solvable *s)
+{
+  return s - pool->solvables;
+}
 
 extern const char *pool_solvable2str(Pool *pool, Solvable *s);
 static inline const char *pool_solvid2str(Pool *pool, Id p)