cvsuser 04/11/05 15:33:46
Modified: classes pmc2c2.pl
lib/Parrot Pmc2c.pm
Log:
Encourage code reuse of the count_newlines utility subroutine.
Revision Changes Path
1.21 +2 -6 parrot/classes/pmc2c2.pl
Index: pmc2c2.pl
===================================================================
RCS file: /cvs/public/parrot/classes/pmc2c2.pl,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- pmc2c2.pl 19 Oct 2004 18:56:23 -0000 1.20
+++ pmc2c2.pl 5 Nov 2004 23:33:45 -0000 1.21
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: pmc2c2.pl,v 1.20 2004/10/19 18:56:23 nicholas Exp $
+# $Id: pmc2c2.pl,v 1.21 2004/11/05 23:33:45 nicholas Exp $
=head1 NAME
@@ -242,7 +242,7 @@
use lib "$FindBin::Bin/..";
use lib "$FindBin::Bin/../lib";
use Parrot::Vtable;
-use Parrot::Pmc2c;
+use Parrot::Pmc2c qw(count_newlines);
use strict;
use Data::Dumper;
use Getopt::Long;
@@ -298,10 +298,6 @@
close VTD;
}
-sub count_newlines {
- return scalar $_[0] =~ tr/\n//;
-}
-
sub extract_balanced {
my $balance = 0;
my $lines = 0;
1.50 +3 -3 parrot/lib/Parrot/Pmc2c.pm
Index: Pmc2c.pm
===================================================================
RCS file: /cvs/public/parrot/lib/Parrot/Pmc2c.pm,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- Pmc2c.pm 4 Nov 2004 09:07:20 -0000 1.49
+++ Pmc2c.pm 5 Nov 2004 23:33:46 -0000 1.50
@@ -1,5 +1,5 @@
# Copyright: 2004 The Perl Foundation. All Rights Reserved.
-# $Id: Pmc2c.pm,v 1.49 2004/11/04 09:07:20 leo Exp $
+# $Id: Pmc2c.pm,v 1.50 2004/11/05 23:33:46 nicholas Exp $
=head1 NAME
@@ -26,7 +26,7 @@
use Parrot::PMC qw(%pmc_types);
use base qw( Exporter );
[EMAIL PROTECTED] = qw(gen_c gen_h gen_ret dynext_load_code);
[EMAIL PROTECTED] = qw(gen_c gen_h gen_ret dynext_load_code count_newlines);
BEGIN {
@writes = qw(STORE PUSH POP SHIFT UNSHIFT DELETE);
@@ -54,7 +54,7 @@
=cut
sub count_newlines {
- return scalar(() = $_[0] =~ /\n/g);
+ return scalar $_[0] =~ tr/\n//;
}
=item C<gen_ret($method, $body)>