提交 391e7c36 authored 作者: Eliot Gable's avatar Eliot Gable

Rename switch_hash_first() and switch_hash_next() to switch_core_hash_first()…

Rename switch_hash_first() and switch_hash_next() to switch_core_hash_first() and switch_core_hash_next() and deprecate the older versions.
上级 fd177cdf
...@@ -1332,14 +1332,14 @@ SWITCH_DECLARE(void *) switch_core_hash_find_rdlock(_In_ switch_hash_t *hash, _I ...@@ -1332,14 +1332,14 @@ SWITCH_DECLARE(void *) switch_core_hash_find_rdlock(_In_ switch_hash_t *hash, _I
\param hash the hashtable to use \param hash the hashtable to use
\return The element, or NULL if it wasn't found \return The element, or NULL if it wasn't found
*/ */
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *deprecate_me, _In_ switch_hash_t *hash); SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_first(_In_ switch_hash_t *hash);
/*! /*!
\brief Gets the next element of a hashtable \brief Gets the next element of a hashtable
\param hi The current element \param hi The current element
\return The next element, or NULL if there are no more \return The next element, or NULL if there are no more
*/ */
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(_In_ switch_hash_index_t *hi); SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_next(_In_ switch_hash_index_t *hi);
/*! /*!
\brief Gets the key and value of the current hash element \brief Gets the key and value of the current hash element
...@@ -1348,6 +1348,31 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(_In_ switch_hash_index_t ...@@ -1348,6 +1348,31 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(_In_ switch_hash_index_t
\param klen [out] the key's size \param klen [out] the key's size
\param val [out] the value \param val [out] the value
*/ */
SWITCH_DECLARE(void) switch_core_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen)
const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val);
/*!
\brief DEPRECATED in favor of switch_core_hash_first(). Gets the first element of a hashtable.
\param deprecate_me [deprecated] NULL
\param hash the hashtable to use
\return The element, or NULL if it wasn't found
*/
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *deprecate_me, _In_ switch_hash_t *hash);
/*!
\brief DEPRECATED in favor of switch_core_hash_next(). Gets the next element of a hashtable.
\param hi The current element
\return The next element, or NULL if there are no more
*/
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(_In_ switch_hash_index_t *hi);
/*!
\brief DEPRECATED in favor of switch_core_hash_this(). Gets the key and value of the current hash element.
\param hi The current element
\param key [out] the key
\param klen [out] the key's size
\param val [out] the value
*/
SWITCH_DECLARE(void) switch_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen) SWITCH_DECLARE(void) switch_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen)
const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val); const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val);
......
...@@ -222,17 +222,17 @@ SWITCH_DECLARE(void *) switch_core_hash_find_rdlock(switch_hash_t *hash, const c ...@@ -222,17 +222,17 @@ SWITCH_DECLARE(void *) switch_core_hash_find_rdlock(switch_hash_t *hash, const c
return val; return val;
} }
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *deprecate_me, switch_hash_t *hash) SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_first(switch_hash_t *hash)
{ {
return (switch_hash_index_t *) sqliteHashFirst(&hash->table); return (switch_hash_index_t *) sqliteHashFirst(&hash->table);
} }
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t *hi) SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_next(switch_hash_index_t *hi)
{ {
return (switch_hash_index_t *) sqliteHashNext((HashElem *) hi); return (switch_hash_index_t *) sqliteHashNext((HashElem *) hi);
} }
SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key, switch_ssize_t *klen, void **val) SWITCH_DECLARE(void) switch_core_hash_this(switch_hash_index_t *hi, const void **key, switch_ssize_t *klen, void **val)
{ {
if (key) { if (key) {
*key = sqliteHashKey((HashElem *) hi); *key = sqliteHashKey((HashElem *) hi);
...@@ -245,6 +245,25 @@ SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key, ...@@ -245,6 +245,25 @@ SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key,
} }
} }
/* Deprecated */
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *deprecate_me, switch_hash_t *hash)
{
(void*)(deprecate_me);
return switch_core_hash_first(hash);
}
/* Deprecated */
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t *hi)
{
return switch_core_hash_next(hi);
}
/* Deprecated */
SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key, switch_ssize_t *klen, void **val)
{
return switch_core_hash_this(hi, key, klen, val);
}
/* For Emacs: /* For Emacs:
* Local Variables: * Local Variables:
* mode:c * mode:c
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论