On 6/8/05, Chris Lambacher <[EMAIL PROTECTED]> wrote:
> My question is, is there a better way to
> allocate the memory for the array.array object than:
>       a = array.array('B', [0] * (pixels * 2))

cdef unsigned char *buffer
temp_string = PyString_FromStringAndSize(NULL, length)
buffer = <unsigned char *> PyString_AsString(temp_string)

That's one way to do it. But it looks like you just want an area of
memory so why not:

cdef extern from "stdlib.h":
  ctypedef unsigned long size_t
  void *malloc(size_t size)
  void free(void *mem)

?

AGL

-- 
Adam Langley                                      [EMAIL PROTECTED]
http://www.imperialviolet.org                       (+44) (0)7906 332512
PGP: 9113   256A   CC0F   71A6   4C84   5087   CDA5   52DF   2CB6   3D60
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to