r8583 - in /trunk/libtext-csv-perl: CSV_XS.pm CSV_XS.xs ChangeLog META.yml debian/changelog examples/csv2xls

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Thu Oct 25 18:07:58 UTC 2007


Author: gregoa-guest
Date: Thu Oct 25 18:07:58 2007
New Revision: 8583

URL: http://svn.debian.org/wsvn/?sc=1&rev=8583
Log:
New upstream release.

Modified:
    trunk/libtext-csv-perl/CSV_XS.pm
    trunk/libtext-csv-perl/CSV_XS.xs
    trunk/libtext-csv-perl/ChangeLog
    trunk/libtext-csv-perl/META.yml
    trunk/libtext-csv-perl/debian/changelog
    trunk/libtext-csv-perl/examples/csv2xls

Modified: trunk/libtext-csv-perl/CSV_XS.pm
URL: http://svn.debian.org/wsvn/trunk/libtext-csv-perl/CSV_XS.pm?rev=8583&op=diff
==============================================================================
--- trunk/libtext-csv-perl/CSV_XS.pm (original)
+++ trunk/libtext-csv-perl/CSV_XS.pm Thu Oct 25 18:07:58 2007
@@ -28,7 +28,7 @@
 use DynaLoader ();
 
 use vars   qw( $VERSION @ISA );
-$VERSION = "0.31";
+$VERSION = "0.32";
 @ISA     = qw( DynaLoader );
 
 sub PV { 0 }
@@ -77,13 +77,13 @@
     my $proto = shift;
     my $attr  = shift || {};
     my $class = ref ($proto) || $proto	or return;
-    for (keys %$attr) {
+    for (keys %{$attr}) {
 	m/^[a-z]/ && exists $def_attr{$_} and next;
 #	croak?
 #	print STDERR "### Cannot set attribute '$_'\n";
 	return;
 	}
-    my $self  = {%def_attr, %$attr};
+    my $self  = {%def_attr, %{$attr}};
     bless $self, $class;
     defined $self->{types} and $self->types ($self->{types});
     $self;
@@ -372,7 +372,7 @@
     my $self = shift;
     if (@_) {
 	if (my $types = shift) {
-	    $self->{_types} = join "", map { chr $_ } @$types;
+	    $self->{_types} = join "", map { chr $_ } @{$types};
 	    $self->{types}  = $types;
 	    }
 	else {
@@ -409,6 +409,7 @@
 
  $status       = $csv->status ();      # get the most recent status
  $bad_argument = $csv->error_input (); # get the most recent bad argument
+ $diag         = $csv->error_diag ();  # if an error occured, explains WHY
 
  $status = $csv->print ($io, $colref); # Write an array of fields
                                        # immediately to a file $io
@@ -1030,6 +1031,11 @@
 Basic calls should croak or warn on illegal parameters. Errors
 should be documented.
 
+If ->new () fails, there should be a way to obtain the reason why.
+Currently it is almost impossible to make new () fail, but in the
+future there should be a (default) option to have it fail when
+unsupported options are passed.
+
 =item eol
 
 Discuss an option to make the eol honor the $/ setting. Maybe
@@ -1121,19 +1127,19 @@
 
 =over 2
 
-=item 0.31
+=item 0.33
 
  - croak / carp
- - error cause, check if error_diag () is enough
+ - error cause for failing new ()
  - return undef
- - DIAGNOSTICS setction in pod to *describe* the errors
-
-=item 0.32
+ - DIAGNOSTICS setction in pod to *describe* the errors (see below)
+
+=item 0.34
 
  - allow_double_quoted
  - Text::CSV_XS::Encoded (maybe)
 
-=item 0.33
+=item 0.35
 
  - csv2csv - a script to regenerate a CSV file to follow standards
  - EBCDIC support

Modified: trunk/libtext-csv-perl/CSV_XS.xs
URL: http://svn.debian.org/wsvn/trunk/libtext-csv-perl/CSV_XS.xs?rev=8583&op=diff
==============================================================================
--- trunk/libtext-csv-perl/CSV_XS.xs (original)
+++ trunk/libtext-csv-perl/CSV_XS.xs Thu Oct 25 18:07:58 2007
@@ -19,6 +19,8 @@
 #define CSV_XS_TYPE_NV	2
 
 /* Keep in sync with .pm! */
+#define CACHE_SIZE			32
+
 #define CACHE_ID_quote_char		0
 #define CACHE_ID_escape_char		1
 #define CACHE_ID_sep_char		2
@@ -79,7 +81,7 @@
     byte	 reserved3;
 #endif
 
-    byte	*cache;
+    byte	 cache[CACHE_SIZE];
 
     HV*		 self;
 
@@ -160,7 +162,7 @@
     csv->self  = self;
 
     if ((svp = hv_fetch (self, "_CACHE", 6, 0)) && *svp) {
-	csv->cache = (byte *)SvPV (*svp, len);
+	memcpy (csv->cache, SvPV (*svp, len), CACHE_SIZE);
 
 	csv->quote_char			= csv->cache[CACHE_ID_quote_char	];
 	csv->escape_char		= csv->cache[CACHE_ID_escape_char	];
@@ -253,33 +255,30 @@
 	csv->verbatim			= bool_opt ("verbatim");
 #endif
 
-	if ((csv->cache = (byte *)malloc (32))) {
-	    csv->cache[CACHE_ID_quote_char]		= csv->quote_char;
-	    csv->cache[CACHE_ID_escape_char]		= csv->escape_char;
-	    csv->cache[CACHE_ID_sep_char]		= csv->sep_char;
-	    csv->cache[CACHE_ID_binary]			= csv->binary;
-
-	    csv->cache[CACHE_ID_keep_meta_info]		= csv->keep_meta_info;
-	    csv->cache[CACHE_ID_alwasy_quote]		= csv->alwasy_quote;
-
-#if ALLOW_ALLOW
-	    csv->cache[CACHE_ID_allow_loose_quotes]	= csv->allow_loose_quotes;
-	    csv->cache[CACHE_ID_allow_loose_escapes]	= csv->allow_loose_escapes;
-	    csv->cache[CACHE_ID_allow_whitespace]	= csv->allow_whitespace;
-	    csv->cache[CACHE_ID_allow_double_quoted]	= csv->allow_double_quoted;
-	    csv->cache[CACHE_ID_verbatim]		= csv->verbatim;
-#endif
-	    csv->cache[CACHE_ID_eol_is_cr]		= csv->eol_is_cr;
-	    csv->cache[CACHE_ID_eol_len]		= csv->eol_len;
-	    if (csv->eol_len > 0 && csv->eol_len < 8 && csv->eol)
-		strcpy ((char *)&csv->cache[CACHE_ID_eol], csv->eol);
-	    csv->cache[CACHE_ID_has_types]		= csv->types ? 1 : 0;
-
-	    if ((csv->tmp = newSVpv ((char *)csv->cache, 32)))
-		hv_store (self, "_CACHE", 6, csv->tmp, 0);
-	    }
-	}
-
+	csv->cache[CACHE_ID_quote_char]			= csv->quote_char;
+	csv->cache[CACHE_ID_escape_char]		= csv->escape_char;
+	csv->cache[CACHE_ID_sep_char]			= csv->sep_char;
+	csv->cache[CACHE_ID_binary]			= csv->binary;
+
+	csv->cache[CACHE_ID_keep_meta_info]		= csv->keep_meta_info;
+	csv->cache[CACHE_ID_alwasy_quote]		= csv->alwasy_quote;
+
+#if ALLOW_ALLOW
+	csv->cache[CACHE_ID_allow_loose_quotes]		= csv->allow_loose_quotes;
+	csv->cache[CACHE_ID_allow_loose_escapes]	= csv->allow_loose_escapes;
+	csv->cache[CACHE_ID_allow_whitespace]		= csv->allow_whitespace;
+	csv->cache[CACHE_ID_allow_double_quoted]	= csv->allow_double_quoted;
+	csv->cache[CACHE_ID_verbatim]			= csv->verbatim;
+#endif
+	csv->cache[CACHE_ID_eol_is_cr]			= csv->eol_is_cr;
+	csv->cache[CACHE_ID_eol_len]			= csv->eol_len;
+	if (csv->eol_len > 0 && csv->eol_len < 8 && csv->eol)
+	    strcpy ((char *)&csv->cache[CACHE_ID_eol], csv->eol);
+	csv->cache[CACHE_ID_has_types]			= csv->types ? 1 : 0;
+
+	if ((csv->tmp = newSVpvn ((char *)csv->cache, CACHE_SIZE)))
+	    hv_store (self, "_CACHE", 6, csv->tmp, 0);
+	}
 
     csv->used = 0;
     } /* SetupCsv */

Modified: trunk/libtext-csv-perl/ChangeLog
URL: http://svn.debian.org/wsvn/trunk/libtext-csv-perl/ChangeLog?rev=8583&op=diff
==============================================================================
--- trunk/libtext-csv-perl/ChangeLog (original)
+++ trunk/libtext-csv-perl/ChangeLog Thu Oct 25 18:07:58 2007
@@ -1,3 +1,11 @@
+2007-10-24  0.32 - H.Merijn Brand   <h.m.brand at xs4all.nl>
+
+	* Added $csv->error_diag () to SYNOPSIS
+	* Added need for diag when new () fails to TODO
+	* Fixed a sneaked-in defined or in examples/csv2xls
+	* Plugged a 32byte memory leak in the cache code (valgrind++)
+	* Some perlcritic level1 changes
+
 2007-07-23  0.31 - H.Merijn Brand   <h.m.brand at xs4all.nl>
 
 	* Removed prototypes in examples/csv2xls

Modified: trunk/libtext-csv-perl/META.yml
URL: http://svn.debian.org/wsvn/trunk/libtext-csv-perl/META.yml?rev=8583&op=diff
==============================================================================
--- trunk/libtext-csv-perl/META.yml (original)
+++ trunk/libtext-csv-perl/META.yml Thu Oct 25 18:07:58 2007
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                Text-CSV_XS
-version:             0.31
+version:             0.32
 abstract:            Comma-Separated Values manipulation routines
 license:             perl
 generated_by:        ExtUtils::MakeMaker version 6.36

Modified: trunk/libtext-csv-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libtext-csv-perl/debian/changelog?rev=8583&op=diff
==============================================================================
--- trunk/libtext-csv-perl/debian/changelog (original)
+++ trunk/libtext-csv-perl/debian/changelog Thu Oct 25 18:07:58 2007
@@ -1,10 +1,11 @@
-libtext-csv-perl (0.31-2) UNRELEASED; urgency=low
+libtext-csv-perl (0.32-1) UNRELEASED; urgency=low
 
+  * New upstream release.
   * debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser
     field (source stanza); Homepage field (source stanza). Removed: XS-
     Vcs-Svn fields.
 
- -- gregor herrmann <gregor+debian at comodo.priv.at>  Tue, 09 Oct 2007 22:32:34 +0200
+ -- gregor herrmann <gregor+debian at comodo.priv.at>  Thu, 25 Oct 2007 20:06:42 +0200
 
 libtext-csv-perl (0.31-1) unstable; urgency=low
 

Modified: trunk/libtext-csv-perl/examples/csv2xls
URL: http://svn.debian.org/wsvn/trunk/libtext-csv-perl/examples/csv2xls?rev=8583&op=diff
==============================================================================
--- trunk/libtext-csv-perl/examples/csv2xls (original)
+++ trunk/libtext-csv-perl/examples/csv2xls Thu Oct 25 18:07:58 2007
@@ -1,12 +1,12 @@
 #!/usr/bin/perl
 
 # csv2xls: Convert csv to xls
-#	   (m)'07 [03 Jul 2007]
+#	   (m)'07 [21 Sep 2007]
 
 use strict;
 use warnings;
 
-our $VERSION = "1.2";
+our $VERSION = "1.3";
 
 sub usage
 {
@@ -49,7 +49,7 @@
     ) or usage (1);
 
 my $title = @ARGV && -f $ARGV[0] ? $ARGV[0] : "csv2xls";
-($xls //= $title) =~ s/\.csv$/.xls/;
+($xls ||= $title) =~ s/\.csv$/.xls/;
 
 -s $xls && $frc and unlink $xls;
 if (-s $xls) {




More information about the Pkg-perl-cvs-commits mailing list