Christian Weisgerber wrote:
> Nima Hoda <nimah...@gmail.com> wrote:
> 
>> x11/xfm file manager segfaults on OpenBSD 4.6-stable/amd64 due to
>> many vararg libXt calls (XtVa...) being terminated with 0 instead
>> of with NULL.
> 
> But this is wrong.  They need to be terminated with (void *)0.
> Or (void *)NULL if you like.  Plain NULL is _not_ a null pointer
> constant.
> 

But it's not a null pointer constant that the spec calls for but
rather NULL itself:

  Each procedure named XtVasomething takes as its last arguments ...
  a variable parameter list of resource name and value pairs where
  each name is of type String and each value is of type XtArgVal. The
  end of the list is identified by a name entry containing NULL.

        --X Toolkit Intrinsics - C Language Interface (pg.44) [1]

Looking at the OpenBSD header files, I notice that NULL is defined
alternatively as 0L or __null. I'm not sure where __null is defined,
but integer literals in C code are by default given type int and not
long, and therein seems to lie the problem.

-Nima

[1] HTML: http://lesstif.sourceforge.net/doc/Xt/spec/xt.html
    PDF: http://tinyurl.com/ya2a83o

Reply via email to