Re: cvs: php-src /ext/standard string.c

From: Date: Fri, 09 Sep 2005 14:02:15 +0000
Subject: Re: cvs: php-src /ext/standard string.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-33872@lists.php.net to get a copy of this message
On Sep 5, 2005, at 3:55 AM, Rolland Santimano wrote:
+        while (i < input_len) {
+            U16_FWD_1((UChar *)input, i, input_len);
+            input_codepts++;
There's u_countChar32() function that counts the number of codepoints.
+    if (input_type == IS_UNICODE) {
+        result = emalloc(UBYTES(input_len + num_pad_chars*2 + 1));
+    } else {
+        result = emalloc(input_len + num_pad_chars + 1);
+    }
It's probably better to use eumalloc() for allocating Unicode strings, since it takes care of counting the bytes..
+        result = erealloc(result, UBYTES(result_len+1));
Same here, eurealloc().. -Andrei

« previous php.cvs (#33872) next »