apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <...@manyfish.co.uk>
Subject Re: cvs commit: apr-util/xml apr_xml.c
Date Fri, 21 May 2004 08:51:46 GMT
On Fri, May 21, 2004 at 07:13:44AM -0000, jfclere@apache.org wrote:
> jfclere     2004/05/21 00:13:44
> 
>   Modified:    xml      apr_xml.c
>   Log:
>   Print "No parser." in errbuf when parser is NULL.

Why? Passing a NULL parser argument to apr_xml_parser_geterror sounds
like a good time to SIGSEGV.  Have you read the code style guide?

>   --- apr_xml.c	13 Feb 2004 09:55:27 -0000	1.28
>   +++ apr_xml.c	21 May 2004 07:13:44 -0000	1.29
>   @@ -414,15 +414,21 @@
>                                                char *errbuf,
>                                                apr_size_t errbufsize)
>    {
>   -    int error = parser->error;
>   +    int error = 0;
>        const char *msg;
>    
>        /* clear our record of an error */
>   -    parser->error = 0;
>   +    if (parser != NULL) {
>   +        error = parser->error;
>   +        parser->error = 0;
>   +    }
>    
>        switch (error) {
>        case 0:
>   -        msg = "No error.";
>   +        if (parser != NULL)
>   +            msg = "No error.";
>   +        else
>   +            msg = "No parser.";
>            break;
>    
>        case APR_XML_NS_ERROR_UNKNOWN_PREFIX:
>   
>   
>   


Mime
View raw message