Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 49793 invoked by uid 500); 22 Oct 2002 05:08:27 -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 49782 invoked from network); 22 Oct 2002 05:08:26 -0000 Date: Tue, 22 Oct 2002 01:08:35 -0400 (EDT) From: rbb@apache.org X-Sender: rbb@shell.ntrnet.net To: Aaron Bannert Cc: dev@apr.apache.org Subject: Re: cvs commit: apr/memory/unix apr_pools.c In-Reply-To: <20021022045815.GQ31238@clove.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Mon, 21 Oct 2002, Aaron Bannert wrote: > On Tue, Oct 22, 2002 at 02:23:20AM -0000, Ryan Bloom wrote: > > rbb 2002/10/21 19:23:20 > > > > Modified: include apr_errno.h > > memory/unix apr_pools.c > > Log: > > Allow people who use userdata to distinguish between a successful retrieval > > from the pool userdata, and not being able to retrieve. We could also > > separate out when the hash doesn't exist, but I have left that for somebody > > else. > ... > > - if (pool->user_data == NULL) > > + if (pool->user_data == NULL) { > > *data = NULL; > > - else > > + } > > + else { > > *data = apr_hash_get(pool->user_data, key, APR_HASH_KEY_STRING); > > + } > > + > > + if (*data == NULL) { > > + return APR_KEYNOTFOUND; > > + } > > > > return APR_SUCCESS; > > } > > > Isn't this going to break something? The find_entry() function isn't > able to tell the difference between an unset key and a NULL value, > so why do we pretend to know the difference here? There are a bunch of > places that I see in thread.c, threadpriv.c, and sockets.c that will > start returning errors now where before they didn't, just because > the error != APR_SUCCESS. Am I seeing this correctly? If you try to get a value from the table, and the value isn't set, then we shouldn't return NULL. The fact that we can't determine the difference between a NULL entry and an unset key is proof that the hash table API is incorrect. We should fix the API ASAP. I don't see the code in thread.c, threadpriv.c, and sockets,c that may break. The only place that those files call these functions is when we are exposing the userdata in the pool inside the incomplete type. Ryan _______________________________________________________________________________ Ryan Bloom rbb@apache.org 550 Jean St Oakland CA 94610 -------------------------------------------------------------------------------