Репозитории ALT
S: | 1.7.0-alt4 |
D: | 1.2.12-alt2.1 |
5.1: | 1.4.6-alt0.M51.1 |
4.1: | 1.2.12-alt2 |
4.0: | 1.2.8-alt1.2 |
+updates: | 1.2.8-alt1.2 |
Группа :: Система/Библиотеки
Пакет: apr1
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: apr-1.2.8-asf-apr_table_clone.patch
Скачать
Скачать
include/apr_tables.h | 9 +++++++++
tables/apr_tables.c | 14 ++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/include/apr_tables.h b/include/apr_tables.h
index 6e9bb58..b6d7727 100644
--- a/include/apr_tables.h
+++ b/include/apr_tables.h
@@ -204,6 +204,15 @@ APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p,
const apr_table_t *t);
/**
+ * Create a new table whose contents are copied from the given table
+ * @param p The pool to allocate the new table out of
+ * @param t The table to clone
+ * @return A clone of the table passed in
+ */
+APR_DECLARE(apr_table_t *) apr_table_clone(apr_pool_t *p,
+ const apr_table_t *t);
+
+/**
* Delete all of the elements from a table
* @param t The table to clear
*/
diff --git a/tables/apr_tables.c b/tables/apr_tables.c
index 54b6eb0..076d9da 100644
--- a/tables/apr_tables.c
+++ b/tables/apr_tables.c
@@ -412,6 +412,20 @@ APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p, const apr_table_t *t)
return new;
}
+APR_DECLARE(apr_table_t *) apr_table_clone(apr_pool_t *p, const apr_table_t *t)
+{
+ const apr_array_header_t *array = apr_table_elts(t);
+ apr_table_entry_t *elts = (apr_table_entry_t *) array->elts;
+ apr_table_t *new = apr_table_make(p, array->nelts);
+ int i;
+
+ for (i = 0; i < array->nelts; i++) {
+ apr_table_add(new, elts[i].key, elts[i].val);
+ }
+
+ return new;
+}
+
static void table_reindex(apr_table_t *t)
{
int i;