From 7001f2c3a1f293cf2f0a1fc00ef8d3ca29673e57 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Wed, 28 Feb 2018 16:26:21 +0100 Subject: [PATCH] Fix Selection.clone implementation and documentation --- bindings/solv.i | 6 ++---- doc/gen/libsolv-bindings.3 | 12 ++++++------ doc/libsolv-bindings.txt | 11 +++++++++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/bindings/solv.i b/bindings/solv.i index b3892a0b..acd01ac4 100644 --- a/bindings/solv.i +++ b/bindings/solv.i @@ -1299,11 +1299,9 @@ typedef struct { } %newobject clone; Selection *clone(int flags = 0) { - Selection *s; - s = solv_calloc(1, sizeof(*s)); - s->pool = $self->pool; + Selection *s = new_Selection($self->pool); + queue_init_clone(&s->q, &$self->q); s->flags = $self->flags; - queue_init_clone(&s>q, &$self>q); return s; } void filter(Selection *lsel) { diff --git a/doc/gen/libsolv-bindings.3 b/doc/gen/libsolv-bindings.3 index 5bb63661..a6534aa2 100644 --- a/doc/gen/libsolv-bindings.3 +++ b/doc/gen/libsolv-bindings.3 @@ -2,12 +2,12 @@ .\" Title: Libsolv-Bindings .\" Author: [see the "Author" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/18/2018 +.\" Date: 02/28/2018 .\" Manual: LIBSOLV .\" Source: libsolv .\" Language: English .\" -.TH "LIBSOLV\-BINDINGS" "3" "02/27/2018" "libsolv" "LIBSOLV" +.TH "LIBSOLV\-BINDINGS" "3" "02/28/2018" "libsolv" "LIBSOLV" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -3167,7 +3167,7 @@ Back pointer to pool\&. .RS 4 .\} .nf -\fBint flags()\fR; +\fBint flags()\fR my \fI$flags\fR \fB=\fR \fI$sel\fR\fB\->flags()\fR; \fIflags\fR \fB=\fR \fIsel\fR\fB\&.flags()\fR \fIflags\fR \fB=\fR \fIsel\fR\fB\&.flags()\fR @@ -3182,7 +3182,7 @@ Return the result flags of the selection\&. The flags are a subset of the ones u .RS 4 .\} .nf -\fBbool isempty()\fR; +\fBbool isempty()\fR \fI$sel\fR\fB\->isempty()\fR \fIsel\fR\fB\&.isempty()\fR \fIsel\fR\fB\&.isempty?\fR @@ -3197,7 +3197,7 @@ Return true if the selection is empty, i\&.e\&. no package could be matched\&. .RS 4 .\} .nf -\fBSelection clone(int\fR \fIflags\fR \fB= 0)\fR; +\fBSelection clone(int\fR \fIflags\fR \fB= 0)\fR my \fI$cloned\fR \fB=\fR \fI$sel\fR\fB\->clone()\fR; \fIcloned\fR \fB=\fR \fIsel\fR\fB\&.clone()\fR \fIcloned\fR \fB=\fR \fIsel\fR\fB\&.clone()\fR @@ -3206,7 +3206,7 @@ my \fI$cloned\fR \fB=\fR \fI$sel\fR\fB\->clone()\fR; .RE .\} .sp -Clone selection\&. +Return a copy of a selection\&. .sp .if n \{\ .RS 4 diff --git a/doc/libsolv-bindings.txt b/doc/libsolv-bindings.txt index 0d336cec..1f6422f1 100644 --- a/doc/libsolv-bindings.txt +++ b/doc/libsolv-bindings.txt @@ -1782,7 +1782,7 @@ Back pointer to pool. === METHODS === - int flags(); + int flags() my $flags = $sel->flags(); flags = sel.flags() flags = sel.flags() @@ -1795,13 +1795,20 @@ flags will either be SELECTION_NAME or SELECTION_PROVIDES depending if there was a package that matched the name or not. If there was no match at all, the flags will be zero. - bool isempty(); + bool isempty() $sel->isempty() sel.isempty() sel.isempty? Return true if the selection is empty, i.e. no package could be matched. + Selection clone(int flags = 0) + my $cloned = $sel->clone(); + cloned = sel.clone() + cloned = sel.clone() + +Return a copy of a selection. + void filter(Selection *other) $sel->filter($other); sel.filter(other) -- 2.47.2