Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 58960 invoked by uid 500); 23 Aug 2001 03:30:17 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 58945 invoked from network); 23 Aug 2001 03:30:16 -0000 X-Authentication-Warning: kurgan.lyra.org: gstein set sender to gstein@lyra.org using -f Date: Wed, 22 Aug 2001 20:35:22 -0700 From: Greg Stein To: dev@apr.apache.org Subject: Re: cvs commit: apr-util/test testdbm.c Message-ID: <20010822203522.C16727@lyra.org> Mail-Followup-To: dev@apr.apache.org References: <20010822224013.85448.qmail@icarus.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20010822224013.85448.qmail@icarus.apache.org>; from ianh@apache.org on Wed, Aug 22, 2001 at 10:40:13PM -0000 X-URL: http://www.lyra.org/greg/ X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N 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/