You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2012/01/04 22:09:38 UTC

[lucy-commits] svn commit: r1227324 - /incubator/lucy/trunk/perl/xs/Lucy/Analysis/CaseFolder.c

Author: marvin
Date: Wed Jan  4 21:09:38 2012
New Revision: 1227324

URL: http://svn.apache.org/viewvc?rev=1227324&view=rev
Log:
LUCY-206 Spell out perlapi function to_utf8_lower.

Perl 5.15.6 has broken to_utf8_lower() in a way which is hard to fix.  Use the
underlying function Perl__to_utf8_lower_flags() for that specific Perl
version.

For earlier Perls, use the fully qualified function Perl_to_utf8_lower().
This probably speeds us up a bit on threaded perls, since we pass aTHX_
instead of getting the implicit context (see perlguts).

Modified:
    incubator/lucy/trunk/perl/xs/Lucy/Analysis/CaseFolder.c

Modified: incubator/lucy/trunk/perl/xs/Lucy/Analysis/CaseFolder.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/xs/Lucy/Analysis/CaseFolder.c?rev=1227324&r1=1227323&r2=1227324&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/xs/Lucy/Analysis/CaseFolder.c (original)
+++ incubator/lucy/trunk/perl/xs/Lucy/Analysis/CaseFolder.c Wed Jan  4 21:09:38 2012
@@ -26,10 +26,6 @@
 #include "Lucy/Util/Memory.h"
 #include "Lucy/Util/StringHelper.h"
 
-#ifndef _to_utf8_lower_flags
-  #define _to_utf8_lower_flags Perl__to_utf8_lower_flags
-#endif
-
 static size_t
 S_lc_to_work_buf(lucy_CaseFolder *self, uint8_t *source, size_t len,
                  uint8_t **buf, uint8_t **limit) {
@@ -38,10 +34,16 @@ S_lc_to_work_buf(lucy_CaseFolder *self, 
     uint8_t            *dest_start = dest;
     uint8_t *const      end        = source + len;
     uint8_t             utf8_buf[7];
+    dTHX;
 
     while (source < end) {
         STRLEN buf_utf8_len;
-        (void)to_utf8_lower(source, utf8_buf, &buf_utf8_len);
+        #if (PERL_VERSION == 15 && PERL_SUBVERSION >= 6)
+        Perl__to_utf8_lower_flags(aTHX_ source, utf8_buf, &buf_utf8_len,
+                                  0, NULL);
+        #else
+        Perl_to_utf8_lower(aTHX_ source, utf8_buf, &buf_utf8_len);
+        #endif
 
         // Grow if necessary.
         if (((STRLEN)(*limit - dest)) < buf_utf8_len) {