[Pcre-svn] [142] code/trunk/src: Config returns code unit co…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [142] code/trunk/src: Config returns code unit count for strings - didn' t always.
Revision: 142
          http://www.exim.org/viewvc/pcre2?view=rev&revision=142
Author:   ph10
Date:     2014-11-11 10:50:31 +0000 (Tue, 11 Nov 2014)


Log Message:
-----------
Config returns code unit count for strings - didn't always.

Modified Paths:
--------------
    code/trunk/src/pcre2_config.c
    code/trunk/src/pcre2test.c


Modified: code/trunk/src/pcre2_config.c
===================================================================
--- code/trunk/src/pcre2_config.c    2014-11-11 10:21:23 UTC (rev 141)
+++ code/trunk/src/pcre2_config.c    2014-11-11 10:50:31 UTC (rev 142)
@@ -129,9 +129,8 @@
 #ifdef SUPPORT_JIT
     {
     const char *v = PRIV(jit_get_target)();
-    return (where == NULL)?
-      (int)((strlen(v) + 1) * sizeof(PCRE2_UCHAR)) :
-      PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v) + 1;
+    return 1 + ((where == NULL)?
+      (int)strlen(v) : PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v));
     }
 #else
   return PCRE2_ERROR_BADOPTION;
@@ -172,10 +171,9 @@
 #else
     const char *v = "Unicode not supported";
 #endif
-    return (where == NULL)?
-      (int)((strlen(v) + 1) * sizeof(PCRE2_UCHAR)) :
-      PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v) + 1;
-    }
+    return 1 + ((where == NULL)?
+      (int)strlen(v): PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v));
+   }
   break;


   case PCRE2_CONFIG_UNICODE:
@@ -210,9 +208,8 @@
     const char *v = (XSTRING(Z PCRE2_PRERELEASE)[1] == 0)?
       XSTRING(PCRE2_MAJOR.PCRE2_MINOR PCRE2_DATE) :
       XSTRING(PCRE2_MAJOR.PCRE2_MINOR) XSTRING(PCRE2_PRERELEASE PCRE2_DATE);
-    return (where == NULL)?
-      (int)((strlen(v) + 1) * sizeof(PCRE2_UCHAR)) :
-      PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v) + 1;
+    return 1 + ((where == NULL)?
+      (int)strlen(v) : PRIV(strcpy_c8)((PCRE2_UCHAR *)where, v));
     }
   }



Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c    2014-11-11 10:21:23 UTC (rev 141)
+++ code/trunk/src/pcre2test.c    2014-11-11 10:50:31 UTC (rev 142)
@@ -5768,7 +5768,7 @@
   print_unicode_version(stdout);
   printf(")\n");
   }
-else printf("  No UTF or UCP support\n");
+else printf("  No Unicode support\n");


(void)PCRE2_CONFIG(PCRE2_CONFIG_JIT, &rc);
if (rc != 0)