diff options
author | brianp <brianp@13f79535-47bb-0310-9956-ffa450edef68> | 2002-07-27 22:59:20 +0000 |
---|---|---|
committer | brianp <brianp@13f79535-47bb-0310-9956-ffa450edef68> | 2002-07-27 22:59:20 +0000 |
commit | 5b1b7457e074f422fcf2553c511f35a297382f7e (patch) | |
tree | 78112a5e4d4310082f03115f0ab33ee866c3bf6b /tables | |
parent | 9b665d8bf7b2842cc7cb1775b936b4d7c3ddc66f (diff) | |
download | libapr-5b1b7457e074f422fcf2553c511f35a297382f7e.tar.gz |
Fixed a bug in apr_table_set/setn from an earlier change: entries
at the end of the table weren't being properly shifted when apr_table_set/setn
removed duplicate keys (found using "testtable" in apr/test)
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63735 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tables')
-rw-r--r-- | tables/apr_tables.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tables/apr_tables.c b/tables/apr_tables.c index c4181ffe4..8e5107520 100644 --- a/tables/apr_tables.c +++ b/tables/apr_tables.c @@ -495,6 +495,7 @@ APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key, { apr_table_entry_t *next_elt; apr_table_entry_t *end_elt; + apr_table_entry_t *table_end; apr_uint32_t checksum; int hash; @@ -507,6 +508,7 @@ APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key, } next_elt = ((apr_table_entry_t *) t->a.elts) + t->index_first[hash];; end_elt = ((apr_table_entry_t *) t->a.elts) + t->index_last[hash]; + table_end =((apr_table_entry_t *) t->a.elts) + t->a.nelts; for (; next_elt <= end_elt; next_elt++) { if ((checksum == next_elt->key_checksum) && @@ -540,8 +542,6 @@ APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key, * for the index) */ if (dst_elt) { - apr_table_entry_t *table_end = - ((apr_table_entry_t *) t->a.elts) + t->a.nelts; for (; next_elt < table_end; next_elt++) { *dst_elt++ = *next_elt; } @@ -567,6 +567,7 @@ APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key, { apr_table_entry_t *next_elt; apr_table_entry_t *end_elt; + apr_table_entry_t *table_end; apr_uint32_t checksum; int hash; @@ -579,6 +580,7 @@ APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key, } next_elt = ((apr_table_entry_t *) t->a.elts) + t->index_first[hash];; end_elt = ((apr_table_entry_t *) t->a.elts) + t->index_last[hash]; + table_end =((apr_table_entry_t *) t->a.elts) + t->a.nelts; for (; next_elt <= end_elt; next_elt++) { if ((checksum == next_elt->key_checksum) && @@ -612,8 +614,6 @@ APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key, * for the index) */ if (dst_elt) { - apr_table_entry_t *table_end = - ((apr_table_entry_t *) t->a.elts) + t->a.nelts; for (; next_elt < table_end; next_elt++) { *dst_elt++ = *next_elt; } |