apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apr-util/test testdbm.c
Date Thu, 23 Aug 2001 03:35:22 GMT
On Wed, Aug 22, 2001 at 10:40:13PM -0000, ianh@apache.org wrote:
>...
>   --- testdbm.c	2001/08/22 15:40:29	1.8
>   +++ testdbm.c	2001/08/22 22:40:12	1.9

As a general note: testdbm.c is derived from dbu.c in the (very old) SDBM
tarball. As such, it is written using a style/technique/whatever circa 1991.
Please feel free to revamp at will to make it feel like a "real" tool.

>...
>   @@ -176,17 +180,21 @@
>        char *op;
>        int n;
>        char *line;
>   +    const char *use1;
>   +    const char *use2;
>    #ifdef TIME
>        long start;
>        extern long time();
>    #endif
>    
>   -    if (apr_dbm_open(&db, file, act->flags, APR_OS_DEFAULT, pool) 
>   -        != APR_SUCCESS)
>   -        oops("cannot open: %s", file);
>    
>   -    if ((line = (char *) malloc(LINEMAX)) == NULL)
>   -        oops("%s: cannot get memory", "line alloc");
>   +    rv = apr_dbm_open(&db, file, act->flags, APR_OS_DEFAULT, pool);
>   +    if (rv != APR_SUCCESS)
>   +        oops(db, rv, "cannot open: %s", file);
>   +
>   +    if ((line = (char *) apr_palloc(pool,LINEMAX)) == NULL) {
>   +        oops(NULL, APR_EGENERAL, "%s: cannot get memory", "line alloc");
>   +    }

apr_palloc() will never return NULL. No need for such a complex test.

>...
>   @@ -263,6 +286,10 @@
>            break;
>        case DCREAT:
>            break;
>   +    case DNAME:
>   +	apr_dbm_get_usednames(pool, file, &use1, &use2);
>   +	fprintf(stderr, "%s %s\n", use1, use2);
>   +	break;

There are tabs in that source code (Apache code should not have tabs).
Please fix your editor.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message