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

Juha Heinanen jh at tutpro.com
Thu Jan 8 10:51:45 CET 2009


Iñaki Baz Castillo writes:

 > 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;" ?

pcre_fullinfo returns 0 (success) if compilation of pattern had
succeeded.  the cast is there because reg_ex_comp returns a pointer, not
an int.

-- juha



More information about the Devel mailing list