Author: cazfi
Date: Sun Dec 20 22:18:16 2015
New Revision: 31126

URL: http://svn.gna.org/viewcvs/freeciv?rev=31126&view=rev
Log:
Make core string comparison functions faster by assuming that UTF8 strings 
passed to them are
well-formed.

See patch #6695

Modified:
    trunk/utility/support.c

Modified: trunk/utility/support.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/support.c?rev=31126&r1=31125&r2=31126&view=diff
==============================================================================
--- trunk/utility/support.c     (original)
+++ trunk/utility/support.c     Sun Dec 20 22:18:16 2015
@@ -204,8 +204,8 @@
     UErrorCode err_code0 = U_ZERO_ERROR;
     UErrorCode err_code1 = U_ZERO_ERROR;
 
-    u_strFromUTF8(cmp_buffer0, cmp_buffer_uchars, &len0, str0, -1, &err_code0);
-    u_strFromUTF8(cmp_buffer1, cmp_buffer_uchars, &len1, str1, -1, &err_code1);
+    u_strFromUTF8Lenient(cmp_buffer0, cmp_buffer_uchars, &len0, str0, -1, 
&err_code0);
+    u_strFromUTF8Lenient(cmp_buffer1, cmp_buffer_uchars, &len1, str1, -1, 
&err_code1);
 
     /* No need to handle U_STRING_NOT_TERMINATED_WARNING here as there's '0' 
after
      * the buffers we were using */
@@ -253,8 +253,8 @@
     UErrorCode err_code0 = U_ZERO_ERROR;
     UErrorCode err_code1 = U_ZERO_ERROR;
 
-    u_strFromUTF8(cmp_buffer0, cmp_buffer_uchars, &len0, str0, -1, &err_code0);
-    u_strFromUTF8(cmp_buffer1, cmp_buffer_uchars, &len1, str1, -1, &err_code1);
+    u_strFromUTF8Lenient(cmp_buffer0, cmp_buffer_uchars, &len0, str0, -1, 
&err_code0);
+    u_strFromUTF8Lenient(cmp_buffer1, cmp_buffer_uchars, &len1, str1, -1, 
&err_code1);
 
     /* No need to handle U_STRING_NOT_TERMINATED_WARNING here as there's '0' 
after
      * the buffers we were using */


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to