texinfo-commits
[Top][All Lists]
Advanced

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

[7594] MiscXS use bytes_to_utf8


From: gavinsmith0123
Subject: [7594] MiscXS use bytes_to_utf8
Date: Sat, 31 Dec 2016 16:39:33 +0000 (UTC)

Revision: 7594
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7594
Author:   gavin
Date:     2016-12-31 16:39:33 +0000 (Sat, 31 Dec 2016)
Log Message:
-----------
MiscXS use bytes_to_utf8

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/MiscXS/miscxs.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-12-31 15:46:32 UTC (rev 7593)
+++ trunk/ChangeLog     2016-12-31 16:39:33 UTC (rev 7594)
@@ -1,11 +1,13 @@
 2016-12-31  Gavin Smith  <address@hidden>
 
-       * tp/Texinfo/MiscXS/miscxs.c (xs_abort_empty_line): Use 
-       'bytes_to_utf8' instead of calling 'sv_utf8_upgrade'.  The 
-       latter appears to cause strange results under perl 5.10.1 
-       (possibly involving the value of $1), and there is a warning 
-       about using 'sv_utf8_upgrade' in the perlguts
+       * tp/Texinfo/MiscXS/miscxs.c (xs_abort_empty_line)
+       (xs_merge_text): Use 'bytes_to_utf8' instead of calling 
+       'sv_utf8_upgrade'.  The latter appears to cause strange results 
+       under perl 5.10.1 (possibly involving the value of $1), and 
+       there is a warning about using 'sv_utf8_upgrade' in the perlguts
        man page.
+       * tp/Texinfo/MiscXS/MiscXS.xs (xs_abort_empty_line): Check
+       if an argument is defined with SvOK.
 
 2016-12-31  Gavin Smith  <address@hidden>
 

Modified: trunk/tp/Texinfo/MiscXS/miscxs.c
===================================================================
--- trunk/tp/Texinfo/MiscXS/miscxs.c    2016-12-31 15:46:32 UTC (rev 7593)
+++ trunk/tp/Texinfo/MiscXS/miscxs.c    2016-12-31 16:39:33 UTC (rev 7594)
@@ -266,11 +266,19 @@
 
   dSP;
 
-  if (!SvUTF8 (text_in))
-    sv_utf8_upgrade (text_in);
+  /* Get text in UTF-8. */
+  {
+    STRLEN len;
+    static char *new_string;
+    text = SvPV (text_in, len);
+    if (!SvUTF8 (text_in))
+      {
+        free (new_string);
+        new_string = bytes_to_utf8 (text, &len);
+        text = new_string;
+      }
+  }
 
-  text = SvPV_nolen (text_in);
-
   leading_spaces = strspn (text, whitespace_chars);
   if (text[leading_spaces])
     {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]