Re: Re: ext/sysvmsg
| From: | Melvyn Sopacua | Date: | Tue, 08 Oct 2002 18:20:41 +0000 |
| Subject: | Re: Re: ext/sysvmsg | ||
| References: | 1 | Groups: | php.dev php.qa |
| Request: | Send a blank email to php-dev+get-89244@lists.php.net to get a copy of this message | ||
At 18:56 10/8/2002 +0200, Sascha Schumann wrote:
Thus the rule should be: If autoconf finds the definition, weIt's not a typedef but the struct itself that's provided, so that doesn't work. I've made a patch now, that I'm not too keen on, but works. It boils down to: AC_TRY_COMPILE(...look for msgbuf,use it, otherwise we rely on our own, namespace-protected version. Example:#ifdef HAVE_STRUCT_SYSMSG typedef struct sysmsg php_sysmsg; #elsetypedef struct { long mtype; char mtext[1]; } php_sysmsg;#endif
[AC_DEFINE(HAVE_STRUCT_SYSV_MSGBUF,1,[struct msgbuf is in sys/msg.h])],
[AC_TRY_COMPILE(...look for mymsg,
[AC_DEFINE(HAVE_STRUCT_SYSV_MSGBUF,1,[struct msgbuf is in sys/msg.h]),
AC_DEFINE(msgbuf,mymsg,[msgbuf is called mymsg])
])
])
Then in sysvmsg.c:
#ifdef HAVE_STRUCT_SYSV_MSGBUF
#define php_msgbuf msgbuf
#else
struct php_msgbuf {
long mtype;
char mtext[1];
};
#endif
Replace all occurences of msgbuf with php_msgbuf.
As I said - it works, but it's a double pre-processor replace for mymsg. I think I could just ignore
mymsg all together, but that would create two identical structs defined. Not sure if that's
desirable (read: no idea what that impact and in what way).
Test 001.phpt passes though.
Met vriendelijke groeten / With kind regards,
Webmaster IDG.nl
Melvyn Sopacua
<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"