diff options
author | brianp <brianp@13f79535-47bb-0310-9956-ffa450edef68> | 2002-07-05 08:20:43 +0000 |
---|---|---|
committer | brianp <brianp@13f79535-47bb-0310-9956-ffa450edef68> | 2002-07-05 08:20:43 +0000 |
commit | 0c6f7f4e3a403a61d601b7184bf3fc0f8848d13e (patch) | |
tree | d7dc153ae78ff3798de998ad07e9c7b3cc49f870 /tables/apr_tables.c | |
parent | dbfa71e8341eca485b9665290a6c74e52777eec7 (diff) | |
download | libapr-0c6f7f4e3a403a61d601b7184bf3fc0f8848d13e.tar.gz |
Streamlined the code for apr_table_get()
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63571 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tables/apr_tables.c')
-rw-r--r-- | tables/apr_tables.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tables/apr_tables.c b/tables/apr_tables.c index a6c1602c2..b27a027cb 100644 --- a/tables/apr_tables.c +++ b/tables/apr_tables.c @@ -406,8 +406,8 @@ APR_DECLARE(void) apr_table_clear(apr_table_t *t) APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key) { - apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts; - int i; + apr_table_entry_t *next_elt = (apr_table_entry_t *) t->a.elts; + apr_table_entry_t *last_elt = next_elt + t->a.nelts; apr_uint32_t checksum; if (key == NULL) { @@ -415,9 +415,10 @@ APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key) } COMPUTE_KEY_CHECKSUM(key, checksum); - for (i = 0; i < t->a.nelts; ++i) { - if ((checksum == elts[i].key_checksum) && !strcasecmp(elts[i].key, key)) { - return elts[i].val; + for (; next_elt < last_elt; next_elt++) { + if ((checksum == next_elt->key_checksum) && + !strcasecmp(next_elt->key, key)) { + return next_elt->val; } } |