Hello community,

here is the log from the commit of package perl-Text-BibTeX for 
openSUSE:Factory checked in at 2019-06-20 18:53:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Text-BibTeX (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Text-BibTeX.new.4811 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Text-BibTeX"

Thu Jun 20 18:53:27 2019 rev:13 rq:710398 version:0.88

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Text-BibTeX/perl-Text-BibTeX.changes        
2018-04-26 13:34:19.992211686 +0200
+++ 
/work/SRC/openSUSE:Factory/.perl-Text-BibTeX.new.4811/perl-Text-BibTeX.changes  
    2019-06-20 18:53:31.272691351 +0200
@@ -1,0 +2,19 @@
+Mon Jun 17 15:04:25 UTC 2019 - Pedro Monreal Gonzalez 
<[email protected]>
+
+- update to 0.88
+   see /usr/share/doc/packages/perl-Text-BibTeX/Changes
+
+  0.88 2019-04-29
+   * Make namebug.c compile with non std99 compiler.
+  0.87 2019-04-06
+   * Fix 0.86 release
+  0.86 2019-03-31
+   * Install btparse.h header file (Alberto Simões)
+   * Fix compilation issues with some compilers (Tobias Schlemmer)
+   * Fix some crashes and malfunctinos in bt_format_name and bt_split_name 
(Tobias Schlemmer)
+   * Issue warnings for unmatched braces (Tobias Schlemmer)
+- Updated URL to MetaCPAN
+- Added missing btparse.h to the devel package
+- Updated spec file with spec-cleaner
+
+-------------------------------------------------------------------

Old:
----
  Text-BibTeX-0.85.tar.gz

New:
----
  Text-BibTeX-0.88.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Text-BibTeX.spec ++++++
--- /var/tmp/diff_new_pack.qQL9fA/_old  2019-06-20 18:53:31.844692135 +0200
+++ /var/tmp/diff_new_pack.qQL9fA/_new  2019-06-20 18:53:31.848692140 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-Text-BibTeX
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,32 +12,35 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
+%define cpan_name Text-BibTeX
 Name:           perl-Text-BibTeX
-Version:        0.85
+Version:        0.88
 Release:        0
-%define cpan_name Text-BibTeX
 Summary:        Interface to Read and Parse BibTeX Files
 License:        Artistic-1.0 OR GPL-1.0-or-later
 Group:          Development/Libraries/Perl
-Url:            http://search.cpan.org/dist/Text-BibTeX/
+URL:            https://metacpan.org/release/Text-BibTeX
 Source0:        
https://cpan.metacpan.org/authors/id/A/AM/AMBS/%{cpan_name}-%{version}.tar.gz
 Source1:        cpanspec.yml
 Patch0:         manual-pages-for-libbtparse.patch
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  glibc-devel
 BuildRequires:  perl
 BuildRequires:  perl-macros
 BuildRequires:  perl(Capture::Tiny) >= 0.06
 BuildRequires:  perl(Config::AutoConf) >= 0.16
+BuildRequires:  perl(Cwd)
 BuildRequires:  perl(ExtUtils::CBuilder) >= 0.27
 BuildRequires:  perl(ExtUtils::LibBuilder) >= 0.02
+BuildRequires:  perl(File::Copy)
 BuildRequires:  perl(Module::Build) >= 0.360300
 BuildRequires:  perl(Scalar::Util) >= 1.42
+Requires:       perl(Encode)
 Requires:       perl(Scalar::Util) >= 1.42
+Requires:       perl(Unicode::Normalize)
 %{perl_requires}
 
 %description
@@ -79,7 +82,7 @@
 find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644
 
 %build
-%{__perl} Build.PL installdirs=vendor optimize="%{optflags}"
+perl Build.PL installdirs=vendor optimize="%{optflags}"
 ./Build build flags=%{?_smp_mflags}
 
 %check
@@ -91,7 +94,6 @@
 %perl_gen_filelist
 
 %post devel -p /sbin/ldconfig
-
 %postun devel -p /sbin/ldconfig
 
 %files -f %{name}.files
@@ -102,6 +104,7 @@
 %files devel
 %defattr(-,root,root,755)
 %{_libdir}/libbtparse.so
-%{_mandir}/man3/*.3.gz
+%{_mandir}/man3/*.3%{?ext_man}
+%{_includedir}/btparse.h
 
 %changelog

++++++ Text-BibTeX-0.85.tar.gz -> Text-BibTeX-0.88.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/Build.PL 
new/Text-BibTeX-0.88/Build.PL
--- old/Text-BibTeX-0.85/Build.PL       2017-08-31 12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/Build.PL       2019-04-29 17:02:41.000000000 +0200
@@ -59,11 +59,13 @@
         'btparse/tests/case_test',
         'btparse/tests/name_test',
         'btparse/tests/purify_test',
+        'btparse/tests/namebug'
     ],
 );
 
 ## HACK  HACK  HACK  HACK
 my $libdir = $builder->install_destination("bin");
+my $hdrdir = undef;
 if ( $^O =~ /mswin32/i ) {
     $libdir = undef;
 
@@ -86,7 +88,7 @@
     }
 }
 else {
-    if ( $Config{archname} =~ /^x86_64|^ppc64|^s390x|^aarch64/ ) {
+    if ( $Config{archname} =~ /^x86_64|^ppc64|^s390x|^aarch64|^riscv64/ ) {
         $libdir =~ s/\bbin\b/lib64/;
         if ( !-d $libdir ) {
             my $test = $libdir;
@@ -97,12 +99,17 @@
     else {
         $libdir =~ s/\bbin\b/lib/;
     }
+    $hdrdir = $libdir;
+    $hdrdir =~ s!/[^/]+/?$!/include!
 }
 $builder->notes( 'btparse_version' => $version );
 $builder->notes( 'lib_path'        => $libdir );
 $builder->add_build_element('usrlib');
-$builder->install_path( 'usrlib' => $libdir );
-
+$builder->install_path( 'usrlib'     => $libdir );
+if (defined($hdrdir)) {
+    $builder->add_build_element('usrinclude');
+    $builder->install_path( 'usrinclude' => $hdrdir );
+}
 $builder->create_build_script;
 
 sub get_version {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/Changes new/Text-BibTeX-0.88/Changes
--- old/Text-BibTeX-0.85/Changes        2017-08-31 12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/Changes        2019-04-29 17:02:41.000000000 +0200
@@ -1,5 +1,17 @@
 Revision history for Perl module Text::BibTeX
 
+0.88 2019-04-29
+ * Make namebug.c compile with non std99 compiler.
+
+0.87 2019-04-06
+ * Fix 0.86 release
+
+0.86 2019-03-31    
+ * Install btparse.h header file (Alberto Simões)
+ * Fix compilation issues with some compilers (Tobias Schlemmer) 
+ * Fix some crashes and malfunctinos in bt_format_name and bt_split_name 
(Tobias Schlemmer)
+ * Issue warnings for unmatched braces (Tobias Schlemmer) 
+
 0.85 2017-08-31
  * FreeBSD includes a definition of strlcat, so no need to redefine it.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/META.json 
new/Text-BibTeX-0.88/META.json
--- old/Text-BibTeX-0.85/META.json      2017-08-31 12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/META.json      2019-04-29 17:02:41.000000000 +0200
@@ -5,7 +5,7 @@
       "Greg Ward <[email protected]>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "Module::Build version 0.4224",
+   "generated_by" : "Module::Build version 0.4229",
    "license" : [
       "perl_5"
    ],
@@ -44,55 +44,55 @@
    "provides" : {
       "Text::BibTeX" : {
          "file" : "lib/Text/BibTeX.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::BibEntry" : {
          "file" : "lib/Text/BibTeX/Bib.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::BibFormat" : {
          "file" : "lib/Text/BibTeX/BibFormat.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::BibSort" : {
          "file" : "lib/Text/BibTeX/BibSort.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::BibStructure" : {
          "file" : "lib/Text/BibTeX/Bib.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::Entry" : {
          "file" : "lib/Text/BibTeX/Entry.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::File" : {
          "file" : "lib/Text/BibTeX/File.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::Name" : {
          "file" : "lib/Text/BibTeX/Name.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::NameFormat" : {
          "file" : "lib/Text/BibTeX/NameFormat.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::SimpleValue" : {
          "file" : "lib/Text/BibTeX/Value.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::Structure" : {
          "file" : "lib/Text/BibTeX/Structure.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::StructuredEntry" : {
          "file" : "lib/Text/BibTeX/Structure.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       },
       "Text::BibTeX::Value" : {
          "file" : "lib/Text/BibTeX/Value.pm",
-         "version" : "0.85"
+         "version" : "0.88"
       }
    },
    "release_status" : "stable",
@@ -104,6 +104,6 @@
          "url" : "http://github.com/ambs/Text-BibTeX";
       }
    },
-   "version" : "0.85",
-   "x_serialization_backend" : "JSON::PP version 2.94"
+   "version" : "0.88",
+   "x_serialization_backend" : "JSON::PP version 4.02"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/META.yml 
new/Text-BibTeX-0.88/META.yml
--- old/Text-BibTeX-0.85/META.yml       2017-08-31 12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/META.yml       2019-04-29 17:02:41.000000000 +0200
@@ -16,7 +16,7 @@
   ExtUtils::LibBuilder: '0.02'
   Module::Build: '0.36'
 dynamic_config: 1
-generated_by: 'Module::Build version 0.4224, CPAN::Meta::Converter version 
2.150010'
+generated_by: 'Module::Build version 0.4229, CPAN::Meta::Converter version 
2.150010'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -25,43 +25,43 @@
 provides:
   Text::BibTeX:
     file: lib/Text/BibTeX.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::BibEntry:
     file: lib/Text/BibTeX/Bib.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::BibFormat:
     file: lib/Text/BibTeX/BibFormat.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::BibSort:
     file: lib/Text/BibTeX/BibSort.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::BibStructure:
     file: lib/Text/BibTeX/Bib.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::Entry:
     file: lib/Text/BibTeX/Entry.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::File:
     file: lib/Text/BibTeX/File.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::Name:
     file: lib/Text/BibTeX/Name.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::NameFormat:
     file: lib/Text/BibTeX/NameFormat.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::SimpleValue:
     file: lib/Text/BibTeX/Value.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::Structure:
     file: lib/Text/BibTeX/Structure.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::StructuredEntry:
     file: lib/Text/BibTeX/Structure.pm
-    version: '0.85'
+    version: '0.88'
   Text::BibTeX::Value:
     file: lib/Text/BibTeX/Value.pm
-    version: '0.85'
+    version: '0.88'
 requires:
   Encode: '0'
   Scalar::Util: '1.42'
@@ -69,5 +69,5 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: http://github.com/ambs/Text-BibTeX
-version: '0.85'
+version: '0.88'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/btparse/src/btparse.h 
new/Text-BibTeX-0.88/btparse/src/btparse.h
--- old/Text-BibTeX-0.85/btparse/src/btparse.h  2017-08-31 12:35:39.000000000 
+0200
+++ new/Text-BibTeX-0.88/btparse/src/btparse.h  2019-04-29 17:02:41.000000000 
+0200
@@ -18,7 +18,6 @@
 #ifndef BTPARSE_H
 #define BTPARSE_H
 
-#include "bt_config.h"
 #include <sys/types.h>
 #include <stdio.h>
 
@@ -198,7 +197,7 @@
 
 typedef struct
 {
-   bt_errclass class;
+   bt_errclass errclass;
    char *      filename;
    int         line;
    char *      item_desc;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/btparse/src/error.c 
new/Text-BibTeX-0.88/btparse/src/error.c
--- old/Text-BibTeX-0.85/btparse/src/error.c    2017-08-31 12:35:39.000000000 
+0200
+++ new/Text-BibTeX-0.88/btparse/src/error.c    2019-04-29 17:02:41.000000000 
+0200
@@ -106,7 +106,7 @@
       something_printed = TRUE;
    }
 
-   name = errclass_names[(int) err->class];
+   name = errclass_names[(int) err->errclass];
    if (name)
    {
       if (something_printed)
@@ -132,7 +132,7 @@
  */
 
 void
-report_error (bt_errclass class, 
+report_error (bt_errclass errclass,
               char *      filename,
               int         line,
               char *      item_desc,
@@ -145,13 +145,13 @@
    int       msg_len;
 #endif
 
-   err.class = class;
+   err.errclass = errclass;
    err.filename = filename;
    err.line = line;
    err.item_desc = item_desc;
    err.item = item;
 
-   errclass_counts[(int) class]++;
+   errclass_counts[(int) errclass]++;
 
 
    /* 
@@ -181,46 +181,46 @@
 #endif
 
    err.message = error_buf;
-   if (err_handlers[class])
-      (*err_handlers[class]) (&err);
+   if (err_handlers[errclass])
+      (*err_handlers[errclass]) (&err);
 
-   switch (err_actions[class])
+   switch (err_actions[errclass])
    {
       case BTACT_NONE: return;
       case BTACT_CRASH: exit (1);
       case BTACT_ABORT: abort ();
       default: internal_error ("invalid error action %d for class %d (%s)", 
-                               (int) err_actions[class],
-                               (int) class, errclass_names[class]);
+                               (int) err_actions[errclass],
+                               (int) errclass, errclass_names[errclass]);
    }
 
 } /* report_error() */
 
 
 GEN_ERRFUNC (general_error,
-             (bt_errclass class, 
+             (bt_errclass errclass, 
               char *      filename,
               int         line,
               char *      item_desc,
               int         item,
               char *      fmt,
               ...),
-             class, filename, line, item_desc, item, fmt)
+             errclass, filename, line, item_desc, item, fmt)
 
 GEN_ERRFUNC (error,
-             (bt_errclass class,
+             (bt_errclass errclass,
               char *      filename, 
               int         line, 
               char *      fmt,
               ...),
-             class, filename, line, NULL, -1, fmt)
+             errclass, filename, line, NULL, -1, fmt)
 
 GEN_ERRFUNC (ast_error,
-             (bt_errclass class,
+             (bt_errclass errclass,
               AST *       ast,
               char *      fmt,
               ...),
-             class, ast->filename, ast->line, NULL, -1, fmt)
+             errclass, ast->filename, ast->line, NULL, -1, fmt)
 
 GEN_ERRFUNC (notify,
              (char * fmt, ...),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/btparse/src/format_name.c 
new/Text-BibTeX-0.88/btparse/src/format_name.c
--- old/Text-BibTeX-0.85/btparse/src/format_name.c      2017-08-31 
12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/btparse/src/format_name.c      2019-04-29 
17:02:41.000000000 +0200
@@ -755,6 +755,7 @@
 
       for (j = 0; j < num_tokens[part]; j++)
       {
+        if (!tokens[part][j]) continue; // ignore empty tokens
          offset += append_text (fname, offset, 
                                 format->pre_token[part], 0, -1);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/btparse/src/names.c 
new/Text-BibTeX-0.88/btparse/src/names.c
--- old/Text-BibTeX-0.85/btparse/src/names.c    2017-08-31 12:35:39.000000000 
+0200
+++ new/Text-BibTeX-0.88/btparse/src/names.c    2019-04-29 17:02:41.000000000 
+0200
@@ -33,12 +33,16 @@
 
 #define MAX_COMMAS 2
 
-#define update_depth(s,offs,depth)              \
-switch (s[offs])                                \
-{                                               \
-   case '{': depth++; break;                    \
-   case '}': depth--; break;                    \
-}
+#define update_depth(c,depth,loc)                                    \
+       switch (c)                                                    \
+               {                                                     \
+       case '{': depth++; break;                                     \
+       case '}':                                                     \
+               if (depth) depth--;                                   \
+               else name_warning (loc, "unmatched '}' (ignoring)");  \
+               break;                                                \
+               }
+
 
 /*
  * `name_loc' specifies where a name is found -- used for generating 
@@ -110,6 +114,11 @@
    int *  stop;                         /* stop of each division */
    bt_stringlist *
           list;                         /* structure to return */
+   name_loc loc;
+
+   loc.filename = filename;
+   loc.line = line;
+   loc.name_num = 0;
 
    if (string == NULL)
       return NULL;
@@ -119,7 +128,11 @@
    string_len = strlen (string);
    delim_len = strlen (delim);
    maxdiv = (string_len / delim_len) + 1;
-   maxoffs = string_len - delim_len + 1;
+   /* Originally, maxoffs = string_len - delim_len + 1, making the code 
+      a little faster (well, if delim has a considerable length.
+      Given the tests added to validate braces nesting, we need to look
+      up to the end of the string. */
+   maxoffs = string_len;
 
    /* 
     * This is a bit of a band-aid solution to the "split empty string"
@@ -169,13 +182,16 @@
       /* no match between string and delim, at non-zero depth, or in a word */
       else
       {
-         update_depth (string, i, depth);
+         update_depth (string[i], depth, &loc);
          inword = (i < string_len) && (string[i] != ' ');
          i++;
          j = 0;
       }
    }
 
+   if (depth)
+          name_warning (&loc, "unmatched '{' (ignoring)");
+
    stop[numdiv] = string_len;           /* last substring ends just past eos */
    list->num_items = numdiv+1;
 
@@ -281,25 +297,26 @@
 static int 
 find_commas (name_loc * loc, char *name, int max_commas)
 {
-   int    i, j;
+   char *i = name, *j = name;
    int    depth;
    int    num_commas;
-   int    len;
-   boolean at_comma;
+   /* int    len; */
+   boolean last_whitespace;
+   /* boolean at_comma; */
    boolean warned;
 
-   i = j = 0;
    depth = 0;
    num_commas = 0;
-   len = strlen (name);
+   /* no need to check length */
+   /*   len = strlen (name); */
    warned = 0;
 
    /* First pass to check for and blank out excess commas */
-
-   for (i = 0; i < len; i++)
+   while(*i)
    {
-      update_depth (name, i, depth);
-      if (depth == 0 && name[i] == ',')
+      char c = *i++; // temporary variable to help optimizatino
+      update_depth (c, depth, loc);
+      if (depth == 0 && c == ',')
       {
          num_commas++;
          if (num_commas > max_commas)
@@ -309,10 +326,24 @@
                name_warning (loc, "too many commas in name (removing extras)");
                warned = TRUE;
             }
-            name[i] = ' ';
+           c = ' ';
          }
+        /* preceeding whitespace is already collapsed.
+           let's replace it with the comma */
+        if (last_whitespace)
+                --j;
+        else /* remove following whitespace */
+                last_whitespace = 1;
+      } else if (isspace(c)) {
+             /* collapse white space */
+             if (last_whitespace) continue;
+             else last_whitespace = 1;
+      } else {
+             last_whitespace = 0;
       }
+      *j++ = c;
    }
+   *j = 0;
 
    /* 
     * If we blanked out a comma, better re-collapse whitespace.  (This is
@@ -320,6 +351,8 @@
     * in the above loop to do the collapsing for me, but my brain
     * hurt when I tried to think it through.  Some other time, perhaps.
     */
+   if (depth)
+          name_warning (loc, "unmatched '{' (ignoring)");
 
    if (warned)
       bt_postprocess_string (name, 1);
@@ -328,43 +361,19 @@
 
    if (num_commas == 0)
       return 0;
-   
-   num_commas = 0;
-   i = 0;
-   while (i < len)
-   {
-      at_comma = (depth == 0 && name[i] == ',');
-      if (at_comma)
-      {
-         while (j > 0 && name[j-1] == ' ') j--;
-         num_commas++;
-      }
 
-      update_depth (name, i, depth);
-      if (i != j)
-         name[j] = name[i];
 
-      i++; j++;
-      if (at_comma)
-      {
-         while (i < len && name[i] == ' ') i++;
-      }
-   } /* while i */
-
-   if (i != j) name[j] = (char) 0;
-   j--;
-
-   if (name[j] == ',') 
+   if (*--j == ',')
    {
       name_warning (loc, "comma(s) at end of name (removing)");
-      while (name[j] == ',')
+      while (*j == ',')
       {
-         name[j--] = (char) 0;
+         *j-- = (char) 0;
          num_commas--;
       }
    }
 
-   return num_commas;
+   return num_commas > max_commas ? max_commas: num_commas;
 
 } /* find_commas() */
 
@@ -373,6 +382,7 @@
 @NAME       : find_tokens
 @INPUT      : name       - string to tokenize (should be a private copy
                            that we're free to clobber and mangle)
+              loc        - location structure for warnings
 @OUTPUT     : comma_token- number of token immediately preceding each comma
                            (caller must allocate with at least one element
                            per comma in `name')
@@ -392,7 +402,8 @@
 -------------------------------------------------------------------------- */
 static bt_stringlist *
 find_tokens (char *  name,
-             int *   comma_token)
+             int *   comma_token,
+            name_loc * loc)
 {
    int    i;                            /* index into name */
    int    num_tok;
@@ -413,6 +424,7 @@
    /* tokens->string = name ? strdup (name) : NULL; */
    tokens->string = name;
    num_tok = 0;
+   tokens->num_items = 0;
    tokens->items = NULL;
 
    if (len == 0)                        /* empty string? */
@@ -456,11 +468,14 @@
          in_boundary = 0;               /* inside a token */
       }
 
-      update_depth (name, i, depth);
+      update_depth (name[i], depth, loc);
       i++;
 
    } /* while i */
 
+   if (depth)
+          name_warning (loc, "unmatched '{' (ignoring)");
+
    tokens->num_items = num_tok;
    return tokens;
 
@@ -813,6 +828,8 @@
          split_name->parts[i] = NULL;
          split_name->part_len[i] = 0;
       }
+      split_name->tokens = NULL;
+      if (name) free(name);
       return split_name;
    }
 
@@ -825,7 +842,7 @@
 
    DBG_ACTION (1, printf ("found %d commas: ", num_commas))
 
-   tokens = find_tokens (name, comma_token);
+   tokens = find_tokens (name, comma_token, &loc);
 
 #if DEBUG
    printf ("found %d tokens:\n", tokens->num_items);
@@ -863,6 +880,7 @@
          split_name->parts[i] = NULL;
          split_name->part_len[i] = 0;
       }
+      split_name->tokens = NULL;
    }
    else
    {
@@ -903,6 +921,7 @@
 void
 bt_free_name (bt_name * name)
 {
+       if (name && name->tokens && name->parts[BTN_LAST])
    DBG_ACTION (2, printf ("bt_free_name(): freeing name %p "
                           "(%d tokens, string=%p (%s), last[0]=%s)\n",
                           name, 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/btparse/tests/namebug.c 
new/Text-BibTeX-0.88/btparse/tests/namebug.c
--- old/Text-BibTeX-0.85/btparse/tests/namebug.c        2017-08-31 
12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/btparse/tests/namebug.c        2019-04-29 
17:02:41.000000000 +0200
@@ -1,8 +1,202 @@
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
+#include <assert.h>
 #include "btparse.h"
 
+#if DEBUG
 void dump_name(bt_name*);
+#else
+#define dump_name(x) do {} while(0)
+#endif
+
+char * normalize_name(char * name) {
+       size_t size = strlen(name);
+       char * result = malloc(size + 1);
+       char * optr=result, *iptr=name;
+       int braces = 0;
+       char inspace = 0;
+       while (*iptr && isspace(*iptr)) ++iptr;
+       while (*iptr) {
+               printf("%c",*iptr);
+               switch (*iptr) {
+               case '{': {
+                       if (braces < 0) {
+                               ++iptr;
+                               break;
+                       }
+                       if (!braces) {
+                               *optr++ = *iptr;
+                       }
+                       ++braces;
+                       ++iptr;
+                       inspace = 0;
+                       break;
+               }
+               case '}': {
+                       if (braces < 0) {
+                               ++iptr;
+                               break;
+                       }
+                       --braces;
+                       if (!braces) {
+                               *optr++ = *iptr;
+                               braces = -1;
+                       }
+                       ++iptr;
+                       inspace=0;
+                       break;
+               }
+               case '\f':
+               case '\r':
+               case '\v':
+               case '\n':
+               case '\t':
+               case ' ': {
+                       if (!inspace) {
+                               *optr++ = *iptr;
+                               inspace = 0;
+                       }
+                       iptr++;
+                       break;
+               }
+               default:
+                       inspace = 0;
+                       *optr++ = *iptr++;
+               }
+       }
+       if (optr != result) {
+               --optr;
+               while (optr != result && isspace(*optr)) --optr;
+               ++optr;
+       }
+       *optr = 0;
+       result = realloc(result, (optr-result)+1);
+       printf("\n");
+       return result;
+}
+
+
+struct nametype {
+       char * given; /*
+                         name_split->parts[BTN_GIVEN],
+                         name_split->part_len[BTN_GIVEN]);
+                    */
+       char * prefix; /*
+                         name_split->parts[BTN_PREFIX],
+                         name_split->part_len[BTN_PREFIX]);
+                  */
+       char * family; /*
+                         name_split->parts[BTN_FAMILY],
+                         name_split->part_len[BTN_FAMILY]);
+                    */
+       char * suffix; /*
+                         name_split->parts[BTN_SUFFIX],
+                         name_split->part_len[BTN_SUFFIX]);
+                   */
+       char * given_i;
+       char * prefix_i;
+       char * family_i;
+       char * suffix_i;
+};
+
+char * inits (char * c) { return c; }
+struct nametype parsename(char * namestr,
+                           char * fieldname) {
+       char * myname;
+       bt_name * name, * nd_name;
+       bt_name_format * l_f = bt_create_name_format("l",  0),
+               *f_f = bt_create_name_format("f", 0),
+               *p_f = bt_create_name_format("v", 0),
+               *s_f = bt_create_name_format("j", 0),
+               *li_f = bt_create_name_format("l",  0),
+               *fi_f = bt_create_name_format("f", 0),
+               *pi_f = bt_create_name_format("v", 0),
+               *si_f = bt_create_name_format("j", 0);
+       struct nametype retval;
+
+
+       myname = normalize_name(namestr);
+       name = bt_split_name(namestr,__FILE__,__LINE__,0);
+       dump_name (name);
+
+       bt_set_format_options(l_f,BTN_LAST,  0, BTJ_MAYTIE, BTJ_NOTHING);
+       bt_set_format_options(f_f,BTN_FIRST, 0, BTJ_MAYTIE, BTJ_NOTHING);
+       bt_set_format_options(p_f,BTN_VON,   0, BTJ_MAYTIE, BTJ_NOTHING);
+       bt_set_format_options(s_f,BTN_JR,    0, BTJ_MAYTIE, BTJ_NOTHING);
+
+       retval.family = bt_format_name(name,l_f);
+       retval.given  = bt_format_name(name,f_f);
+       retval.prefix = bt_format_name(name,p_f);
+       retval.suffix = bt_format_name(name,s_f);
+
+       nd_name = name;
+
+       bt_set_format_text(li_f,BTN_LAST,  NULL, NULL, NULL, "");
+       bt_set_format_text(fi_f,BTN_FIRST, NULL, NULL, NULL, "");
+       bt_set_format_text(pi_f,BTN_VON,   NULL, NULL, NULL, "");
+       bt_set_format_text(si_f,BTN_JR,    NULL, NULL, NULL, "");
+       bt_set_format_options(li_f,BTN_LAST,  1, BTJ_FORCETIE, BTJ_NOTHING);
+       bt_set_format_options(fi_f,BTN_FIRST, 1, BTJ_FORCETIE, BTJ_NOTHING);
+       bt_set_format_options(pi_f,BTN_VON,   1, BTJ_FORCETIE, BTJ_NOTHING);
+       bt_set_format_options(si_f,BTN_JR,    1, BTJ_FORCETIE, BTJ_NOTHING);
+
+       retval.family_i = inits(bt_format_name(nd_name,li_f));
+       retval.given_i  = inits(bt_format_name(nd_name,fi_f));
+       retval.prefix_i = inits(bt_format_name(nd_name,pi_f));
+       retval.suffix_i = inits(bt_format_name(nd_name,si_f));
+
+       free(myname);
+       bt_free_name(name);
+       bt_free_name_format(l_f);
+       bt_free_name_format(f_f);
+       bt_free_name_format(p_f);
+       bt_free_name_format(s_f);
+       bt_free_name_format(li_f);
+       bt_free_name_format(fi_f);
+       bt_free_name_format(pi_f);
+       bt_free_name_format(si_f);
+
+       return retval;
+}
+char * parse_strings[] = {
+         "Ahrens, Dieter and Rottl{\"a}nder, {C.\bibtexspatium A.}",
+         "Ahrens, Dieter and Rottländer, {C.\bibtexspatium A.}",
+         "Ahrens, Dieter and Rottl{\"a}nder, {C.A."
+};
+#define parse_string_count 3
+
+void print_names(struct nametype names) {
+       printf("{ %s; %s; %s; %s  / %s; %s; %s; %s}\n",
+              names.given,
+              names.prefix,
+              names.family,
+              names.suffix,
+              names.given_i,
+              names.prefix_i,
+              names.family_i,
+              names.suffix_i);
+}
+void free_names(struct nametype * names) {
+       free (names->given);
+       free (names->prefix);
+       free (names->family);
+       free (names->suffix);
+       free (names->given_i);
+       free (names->prefix_i);
+       free (names->family_i);
+       free (names->suffix_i);
+}
+
+void test_parsename() {
+    int i;
+       for (i = 0; i < parse_string_count; ++i) {
+               struct nametype names = parsename(parse_strings[i],"editor");
+               print_names(names);
+               free_names(&names);
+       }
+}
 
 int main (void)
 {
@@ -13,7 +207,10 @@
    printf ("split as we go:\n");
    for (i = 0; i < 4; i++)
    {
-      names[i] = bt_split_name (strdup (snames[i]), NULL, 0, 0);
+          char * newsname = strdup(snames[i]);
+      names[i] = bt_split_name (snames[i], NULL, 0, 0);
+      assert (!strcmp(snames[i], newsname));
+      free (newsname);
       dump_name (names[i]);
    }
 
@@ -21,8 +218,10 @@
    for (i = 0; i < 4; i++)
    {
       dump_name (names[i]);
+      bt_free_name(names[i]);
    }
 
+   test_parsename();
    return 0;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/inc/MyBuilder.pm 
new/Text-BibTeX-0.88/inc/MyBuilder.pm
--- old/Text-BibTeX-0.85/inc/MyBuilder.pm       2017-08-31 12:35:39.000000000 
+0200
+++ new/Text-BibTeX-0.88/inc/MyBuilder.pm       2019-04-29 17:02:41.000000000 
+0200
@@ -64,6 +64,7 @@
              . "It seems you are installing in a non standard path.\n"
              . "You might need to add $usrlib to your library search path.\n";
       }
+    
 }
 
 sub ACTION_code {
@@ -106,6 +107,10 @@
 
     $self->dispatch("compile_xscode");
 
+    $self->copy_if_modified( from    => 'btparse/src/btparse.h',
+                                 to_dir  => "blib/usrinclude",
+                                 flatten => 1);
+
     $self->SUPER::ACTION_code;
 }
 
@@ -303,6 +308,14 @@
     if (!$self->up_to_date($objects, $exe_file)) {
         $libbuilder->link_executable(exe_file => $exe_file,
                                      extra_linker_flags => '-Lbtparse/src 
-lbtparse ',
+                                     objects => $objects);
+    }
+
+    $exe_file = catfile("btparse","tests","namebug$EXEEXT");
+    $objects  = [ map{catfile("btparse","tests","$_.o")}(qw.namebug.) ];
+    if (!$self->up_to_date($objects, $exe_file)) {
+        $libbuilder->link_executable(exe_file => $exe_file,
+                                     extra_linker_flags => '-Lbtparse/src 
-lbtparse ',
                                      objects => $objects);
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/lib/Text/BibTeX/Bib.pm 
new/Text-BibTeX-0.88/lib/Text/BibTeX/Bib.pm
--- old/Text-BibTeX-0.85/lib/Text/BibTeX/Bib.pm 2017-08-31 12:35:39.000000000 
+0200
+++ new/Text-BibTeX-0.88/lib/Text/BibTeX/Bib.pm 2019-04-29 17:02:41.000000000 
+0200
@@ -111,7 +111,7 @@
 use strict;
 use vars qw(@ISA $VERSION);
 @ISA = qw(Text::BibTeX::Structure);
-$VERSION = '0.85';
+$VERSION = '0.88';
 
 =head1 STRUCTURE OPTIONS
 
@@ -450,7 +450,7 @@
 use strict;
 use vars qw(@ISA $VERSION);
 
-$VERSION = '0.85';
+$VERSION = '0.88';
 
 use Text::BibTeX::BibSort;
 use Text::BibTeX::BibFormat;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/lib/Text/BibTeX/BibFormat.pm 
new/Text-BibTeX-0.88/lib/Text/BibTeX/BibFormat.pm
--- old/Text-BibTeX-0.85/lib/Text/BibTeX/BibFormat.pm   2017-08-31 
12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/lib/Text/BibTeX/BibFormat.pm   2019-04-29 
17:02:41.000000000 +0200
@@ -26,7 +26,7 @@
 use Text::BibTeX::Structure;
 
 @ISA = qw(Text::BibTeX::StructuredEntry);
-$VERSION = 0.85;
+$VERSION = 0.88;
 
 use Text::BibTeX qw(:subs display_list :nameparts :joinmethods);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/lib/Text/BibTeX/BibSort.pm 
new/Text-BibTeX-0.88/lib/Text/BibTeX/BibSort.pm
--- old/Text-BibTeX-0.85/lib/Text/BibTeX/BibSort.pm     2017-08-31 
12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/lib/Text/BibTeX/BibSort.pm     2019-04-29 
17:02:41.000000000 +0200
@@ -23,7 +23,7 @@
 use Text::BibTeX::Structure;
 
 @ISA = qw(Text::BibTeX::StructuredEntry);
-$VERSION = 0.85;
+$VERSION = 0.88;
 
 use Text::BibTeX qw(purify_string change_case);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/lib/Text/BibTeX/Entry.pm 
new/Text-BibTeX-0.88/lib/Text/BibTeX/Entry.pm
--- old/Text-BibTeX-0.85/lib/Text/BibTeX/Entry.pm       2017-08-31 
12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/lib/Text/BibTeX/Entry.pm       2019-04-29 
17:02:41.000000000 +0200
@@ -23,7 +23,7 @@
 use Carp;
 use Text::BibTeX qw(:metatypes :nodetypes);
 
-$VERSION = 0.85;
+$VERSION = 0.88;
 
 =head1 NAME
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/lib/Text/BibTeX/File.pm 
new/Text-BibTeX-0.88/lib/Text/BibTeX/File.pm
--- old/Text-BibTeX-0.85/lib/Text/BibTeX/File.pm        2017-08-31 
12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/lib/Text/BibTeX/File.pm        2019-04-29 
17:02:41.000000000 +0200
@@ -23,7 +23,7 @@
 use Text::BibTeX::Entry;
 
 use vars qw'$VERSION';
-$VERSION = 0.85;
+$VERSION = 0.88;
 
 =head1 NAME
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/lib/Text/BibTeX/Name.pm 
new/Text-BibTeX-0.88/lib/Text/BibTeX/Name.pm
--- old/Text-BibTeX-0.85/lib/Text/BibTeX/Name.pm        2017-08-31 
12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/lib/Text/BibTeX/Name.pm        2019-04-29 
17:02:41.000000000 +0200
@@ -23,7 +23,7 @@
 use strict;
 use Carp;
 use vars qw'$VERSION';
-$VERSION = 0.85;
+$VERSION = 0.88;
 
 use Text::BibTeX;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/lib/Text/BibTeX/NameFormat.pm 
new/Text-BibTeX-0.88/lib/Text/BibTeX/NameFormat.pm
--- old/Text-BibTeX-0.85/lib/Text/BibTeX/NameFormat.pm  2017-08-31 
12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/lib/Text/BibTeX/NameFormat.pm  2019-04-29 
17:02:41.000000000 +0200
@@ -23,7 +23,7 @@
 use strict;
 use Carp;
 use vars qw'$VERSION';
-$VERSION = 0.85;
+$VERSION = 0.88;
 
 =head1 NAME
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/lib/Text/BibTeX/Structure.pm 
new/Text-BibTeX-0.88/lib/Text/BibTeX/Structure.pm
--- old/Text-BibTeX-0.85/lib/Text/BibTeX/Structure.pm   2017-08-31 
12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/lib/Text/BibTeX/Structure.pm   2019-04-29 
17:02:41.000000000 +0200
@@ -24,7 +24,7 @@
 use Carp;
 
 use vars qw'$VERSION';
-$VERSION = 0.85;
+$VERSION = 0.88;
 
 use Text::BibTeX ('check_class');
 
@@ -870,7 +870,7 @@
 package Text::BibTeX::StructuredEntry;
 use strict;
 use vars qw(@ISA $VERSION);
-$VERSION = 0.85;
+$VERSION = 0.88;
 
 use Carp;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/lib/Text/BibTeX/Value.pm 
new/Text-BibTeX-0.88/lib/Text/BibTeX/Value.pm
--- old/Text-BibTeX-0.85/lib/Text/BibTeX/Value.pm       2017-08-31 
12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/lib/Text/BibTeX/Value.pm       2019-04-29 
17:02:41.000000000 +0200
@@ -22,7 +22,7 @@
 use Carp;
 
 use vars qw'$VERSION';
-$VERSION = 0.85;
+$VERSION = 0.88;
 
 =head1 NAME
 
@@ -245,7 +245,7 @@
 use Text::BibTeX qw(:nodetypes);
 
 use vars qw($VERSION);
-$VERSION = '0.85';
+$VERSION = '0.88';
 
 
 =head2 Text::BibTeX::SimpleValue methods
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/lib/Text/BibTeX.pm 
new/Text-BibTeX-0.88/lib/Text/BibTeX.pm
--- old/Text-BibTeX-0.85/lib/Text/BibTeX.pm     2017-08-31 12:35:39.000000000 
+0200
+++ new/Text-BibTeX-0.88/lib/Text/BibTeX.pm     2019-04-29 17:02:41.000000000 
+0200
@@ -25,7 +25,7 @@
 require Exporter;
 require DynaLoader;
 
-our $VERSION='0.85';
+our $VERSION='0.88';
 
 @ISA = qw(Exporter DynaLoader);
 %EXPORT_TAGS = (nodetypes => [qw(BTAST_STRING BTAST_MACRO BTAST_NUMBER)],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-BibTeX-0.85/t/names.t 
new/Text-BibTeX-0.88/t/names.t
--- old/Text-BibTeX-0.85/t/names.t      2017-08-31 12:35:39.000000000 +0200
+++ new/Text-BibTeX-0.88/t/names.t      2019-04-29 17:02:41.000000000 +0200
@@ -113,9 +113,9 @@
 is (join('', $uname->part('von')), encode('UTF-8','𝓺aa'), "check raw mode");# 
4-byte UTF-8 lowercase (U+1D4FA)
 
 
-ok ($pentry = Text::BibTeX::Entry->new($protected_test));
+ok ($pentry = Text::BibTeX::Entry->new($protected_test), "Got an Entry");
 my $pauthor = $pentry->get ('author');
-is ($pauthor, '{U.S. Department of Health and Human Services, National 
Institute of Mental Health, National Heart, Lung and Blood Institute}');
+is ($pauthor, '{U.S. Department of Health and Human Services, National 
Institute of Mental Health, National Heart, Lung and Blood Institute}', 
"Protected test author is correct");
 @pnames = $pentry->split ('author');
 ok (@pnames == 1 && $pnames[0] eq '{U.S. Department of Health and Human 
Services, National Institute of Mental Health, National Heart, Lung and Blood 
Institute}');
 @pnames = $pentry->names ('author');


Reply via email to