[Kamailio-Devel] Why "lcr" module returns "(pcre *)0" ?

Alex Balashov abalashov at evaristesys.com
Thu Jan 8 00:35:04 CET 2009


I've always wondered about this (or casting NULL to a pointer type), and 
generally had the impression that it is more a matter of convention than 
a necessity of pointer arithmetic or type semantics.

Iñaki Baz Castillo wrote:

> Hi, which is the purpose of this return code in "lcr" module?:
> 
> 
>   rc = pcre_fullinfo(re, NULL, PCRE_INFO_SIZE, &size);
>   if (rc != 0) {
>     LM_ERR("pcre_fullinfo on compiled pattern '%s' yielded error: %d\n",
>             pattern, rc);
>     return (pcre *)0;
>   }
> 
> 
> I've tested it and the returned integer is always 0, so "success"?
> Perhaps is not required by the father function to return error when a PCRE 
> compilation issue occurs, but why "return (pcre *)0;" instead of just "return 
> 0;" ?
> 
> Thanks.
> 


-- 
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (678) 237-1775



More information about the Devel mailing list