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 c6ba79e..0236caf 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 a87f12c..a48b5f2 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))