Return-Path: Delivered-To: apache-cvs-archive@hyperreal.org Received: (qmail 12526 invoked by uid 6000); 29 Dec 1997 17:52:02 -0000 Received: (qmail 12478 invoked by alias); 29 Dec 1997 17:52:00 -0000 Delivered-To: apachen-cvs@hyperreal.org Received: (qmail 12455 invoked by uid 124); 29 Dec 1997 17:51:59 -0000 Date: 29 Dec 1997 17:51:59 -0000 Message-ID: <19971229175159.12452.qmail@hyperreal.org> From: ben@hyperreal.org To: apachen-cvs@hyperreal.org Subject: cvs commit: apachen/src/main alloc.c Sender: apache-cvs-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org ben 97/12/29 09:51:59 Modified: src CHANGES src/main alloc.c Log: Make table_{set,unset}() deal correctly with multiple occurrences of the same key. PR: 1604 Submitted by: Stephen Scheck , Ben Reviewed by: Ben Laurie Revision Changes Path 1.551 +4 -0 apachen/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apachen/src/CHANGES,v retrieving revision 1.550 retrieving revision 1.551 diff -u -r1.550 -r1.551 --- CHANGES 1997/12/28 04:50:59 1.550 +++ CHANGES 1997/12/29 17:51:51 1.551 @@ -1,5 +1,9 @@ Changes with Apache 1.3b4 + *) table_set() and table_unset() did not deal correctly with + multiple occurrences of the same key. [Stephen Scheck + , Ben Laurie] PR#1604 + *) Correct handling of quotation marks in AuthName realm names; as a byproduct, a new function: ap_escape_quotes(). [Ken Coar] PR#1195 1.63 +5 -2 apachen/src/main/alloc.c Index: alloc.c =================================================================== RCS file: /export/home/cvs/apachen/src/main/alloc.c,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- alloc.c 1997/12/26 23:25:46 1.62 +++ alloc.c 1997/12/29 17:51:57 1.63 @@ -732,11 +732,12 @@ table_entry *elts = (table_entry *) t->elts; int done = 0; - for (i = 0; i < t->nelts; ++i) + for (i = 0; i < t->nelts; ) if (!strcasecmp(elts[i].key, key)) { if (!done) { elts[i].val = pstrdup(t->pool, val); done = 1; + ++i; } else { /* delete an extraneous element */ for (j = i, k = i + 1; k < t->nelts; ++j, ++k) { @@ -746,6 +747,7 @@ --t->nelts; } } + else ++i; if (!done) { elts = (table_entry *) push_array(t); @@ -759,7 +761,7 @@ register int i, j, k; table_entry *elts = (table_entry *) t->elts; - for (i = 0; i < t->nelts; ++i) + for (i = 0; i < t->nelts; ) if (!strcasecmp(elts[i].key, key)) { /* found an element to skip over @@ -773,6 +775,7 @@ } --t->nelts; } + else ++i; } API_EXPORT(void) table_merge(table *t, const char *key, const char *val)