[cffi-devel] allocating :count 0 in clisp

Luís Oliveira luismbo at gmail.com
Tue Jun 30 19:11:53 UTC 2009


On Tue, Jun 30, 2009 at 3:13 PM, Tobias
Rautenkranz<tobias at rautenkranz.ch> wrote:
> I had  something like in man malloc in mind:
> "If size is 0, then malloc() returns either NULL, or a unique pointer value
> that can later be successfully passed to free()."

How about making CFFI:FOREIGN-ALLOC always return a null pointer
regardless of what malloc() would do? Would that work?


> I need this for:
> QByteArray ( const char * data, int size )
> I guess the malloc definition should also be fine for stuff like:
>  ssize_t write(int fd, const void *buf, size_t count);
>
> Requiring a null pointer might be to restrictive; SBCL e.g.:
> (cffi:foreign-string-alloc "" :null-terminated-p nil)
> #.(SB-SYS:INT-SAP #X080961A8)
> 0

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/




More information about the cffi-devel mailing list