[Numpy-svn] r3020 - trunk/numpy/core/src

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Aug 14 16:10:29 CDT 2006


Author: oliphant
Date: 2006-08-14 16:10:27 -0500 (Mon, 14 Aug 2006)
New Revision: 3020

Modified:
   trunk/numpy/core/src/arrayobject.c
Log:
Remove strnlen and fix unicode copy and strip

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-08-14 20:27:39 UTC (rev 3019)
+++ trunk/numpy/core/src/arrayobject.c	2006-08-14 21:10:27 UTC (rev 3020)
@@ -4195,7 +4195,7 @@
 static void _rstripw(char *s, int n)
 {
         int i;
-        for(i=strnlen(s,n)-1; i>=1; i--)  /* Never strip to length 0. */
+        for(i=n-1; i>=1; i--)  /* Never strip to length 0. */
         {
                 int c = s[i];
                 if (!c || isspace(c))
@@ -4245,8 +4245,8 @@
 static char *
 _uni_copy_n_strip(char *original, char *temp, int nc)
 {
-        if (nc*4 > SMALL_STRING) {
-                temp = malloc(nc);
+        if (nc*sizeof(PyArray_UCS4) > SMALL_STRING) {
+                temp = malloc(nc*sizeof(PyArray_UCS4));
                 if (!temp) {
                         PyErr_NoMemory();
                         return NULL;



More information about the Numpy-svn mailing list