chiark / gitweb /
fdutils.pyx, str.pyx: Fix some stupid bugs.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 4 Oct 2009 12:32:43 +0000 (13:32 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 4 Oct 2009 12:32:43 +0000 (13:32 +0100)
The warning spew on general Pyrex-generated C code is heavy enough that
I didn't spot the uninitialized-variable warnings in these files.  Fixed
the genuine (and possibly nasty) bugs.

fdutils.pyx
str.pyx

index c6ba79e2c82a36465fbdb8dfb990712001aaaeb3..0236caf9c0c482572b9ebf6ce3153309fd7c9107 100644 (file)
@@ -50,7 +50,7 @@ def fdrecv(sock, unsigned size):
   cdef int len
   cdef PyObject *obj
   cdef int fd
-  buf = PyString_FromStringAndSize(NULL, len)
+  buf = PyString_FromStringAndSize(NULL, size)
   p = PyString_AS_STRING(buf)
   len = fdpass_recv(_getfd(sock), &fd, p, size)
   if len < 0:
diff --git a/str.pyx b/str.pyx
index a87f12cdbf883f4639cf9d3967f96619fce78e0c..a48b5f2ccef14cc50c0af69203ec2c566cebb499 100644 (file)
--- a/str.pyx
+++ b/str.pyx
@@ -78,6 +78,8 @@ def split(char *p, int n = -1, quotep = False):
 
 def match(char *p, char *s, prefixp = False):
   cdef unsigned f
+
+  f = 0
   if prefixp:
     f = f | STRF_PREFIX
   return _tobool(str_matchx(p, s, f))