API inconsistencies

2013-11-25 Thread Nick Kew
Is there a prescribed way for a module to deal with API changes
to support both older and newer versions?

I can use constructs like:

/* Get the remote address */
#if OLDVERSION
len = ngx_sock_ntop(conn->sockaddr, ...
#else
len = ngx_sock_ntop(conn->sockaddr, conn->socklen, …
#endif

But that's just passing the buck to users to figure out why my
module doesn't compile with their nginx or tengine.  I want
a test like Apache's MMN that will automatically detect the
API version to use.  Is there a way to do that?

(FWIW, the above API changed in
http://hg.nginx.org/nginx/rev/05ba5bce31e0 ).

-- 
Nick Kew
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Re: API inconsistencies

2013-11-25 Thread Ruslan Ermilov
On Mon, Nov 25, 2013 at 04:36:33PM +, Nick Kew wrote:
> Is there a prescribed way for a module to deal with API changes
> to support both older and newer versions?
> 
> I can use constructs like:
> 
> /* Get the remote address */
> #if OLDVERSION
> len = ngx_sock_ntop(conn->sockaddr, ...
> #else
> len = ngx_sock_ntop(conn->sockaddr, conn->socklen, …
> #endif
> 
> But that's just passing the buck to users to figure out why my
> module doesn't compile with their nginx or tengine.  I want
> a test like Apache's MMN that will automatically detect the
> API version to use.  Is there a way to do that?
> 
> (FWIW, the above API changed in
> http://hg.nginx.org/nginx/rev/05ba5bce31e0 ).

nginx_version in src/core/nginx.h.

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Re: API inconsistencies

2013-11-25 Thread Nick Kew

On 25 Nov 2013, at 16:46, Ruslan Ermilov wrote:

> nginx_version in src/core/nginx.h.

Thanks.  Seems to be 1.5.3 at the time of that commit, so I guess
the test I need is < 1005003 vs >= 1005003?

But that presumably only works with release versions, so anyone
compiling against arbitrary versions will have to deal with it
case-by-case (in this instance, either API could apply to
version 1005003)?

-- 
Nick Kew

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel