[libchamplain] Scalar context on a XS method is too strange



commit a9c20f31905889fd84b957158193e69efb3b3d29
Author: Emmanuel Rodriguez <emmanuel rodriguez gmail com>
Date:   Thu Jul 9 22:22:13 2009 +0200

    Scalar context on a XS method is too strange

 .../perl/Champlain/t/ChamplainSelectionLayer.t     |   16 +++++++---------
 .../perl/Champlain/xs/ChamplainSelectionLayer.xs   |    5 -----
 2 files changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/bindings/perl/Champlain/t/ChamplainSelectionLayer.t b/bindings/perl/Champlain/t/ChamplainSelectionLayer.t
index e4944da..c042bd6 100644
--- a/bindings/perl/Champlain/t/ChamplainSelectionLayer.t
+++ b/bindings/perl/Champlain/t/ChamplainSelectionLayer.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Clutter::TestHelper tests => 25;
+use Clutter::TestHelper tests => 24;
 
 use Champlain;
 use Data::Dumper;
@@ -23,18 +23,16 @@ sub test_empty {
 	my $layer = Champlain::SelectionLayer->new();
 	isa_ok($layer, 'Champlain::Layer');
 
-	my $count;
-	my @markers;
-
 	is($layer->get_selected, undef, "[empty] get_selected()");
 
 	# In single mode get_selected_markers doesn't work
-	@markers = $layer->get_selected_markers;
-	is_deeply(\ markers, [], "[empty] get_selected_markers() list context");
-	$count = $layer->get_selected_markers;
-	is($count, 0, "[empty] get_selected_markers() scalar context");
+	is_deeply(
+		[$layer->get_selected_markers],
+		[], 
+		"[empty] get_selected_markers()"
+	);
 
-	$count = $layer->count_selected_markers;
+	my $count = $layer->count_selected_markers;
 	is($count, 0, "[empty] count_selected_markers()");
 
 	my $marker = Champlain::BaseMarker->new();
diff --git a/bindings/perl/Champlain/xs/ChamplainSelectionLayer.xs b/bindings/perl/Champlain/xs/ChamplainSelectionLayer.xs
index e36fb31..72d4f29 100644
--- a/bindings/perl/Champlain/xs/ChamplainSelectionLayer.xs
+++ b/bindings/perl/Champlain/xs/ChamplainSelectionLayer.xs
@@ -20,12 +20,7 @@ champlain_selection_layer_get_selected_markers (ChamplainSelectionLayer *layer)
 	
 	PPCODE:
 		item = champlain_selection_layer_get_selected_markers(layer);
-
 		if (!item) {
-			if (GIMME == G_SCALAR) {
-				XPUSHs(sv_2mortal(newSViv(0)));
-				return;
-			}
 			XSRETURN_EMPTY;
 		}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]