mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Add zend_hash_get_current_key_type()
This commit is contained in:
parent
4b023c157a
commit
fd4650b540
2 changed files with 20 additions and 0 deletions
|
@ -1025,6 +1025,21 @@ ZEND_API int zend_hash_get_current_key(HashTable *ht, char **str_index, ulong *n
|
|||
}
|
||||
|
||||
|
||||
ZEND_API int zend_hash_get_current_key_type(HashTable *ht)
|
||||
{
|
||||
Bucket *p = ht->pInternalPointer;
|
||||
|
||||
if (p) {
|
||||
if (p->nKeyLength) {
|
||||
return HASH_KEY_IS_STRING;
|
||||
} else {
|
||||
return HASH_KEY_IS_LONG;
|
||||
}
|
||||
}
|
||||
return HASH_KEY_NON_EXISTANT;
|
||||
}
|
||||
|
||||
|
||||
ZEND_API int zend_hash_get_current_data(HashTable *ht, void **pData)
|
||||
{
|
||||
Bucket *p = ht->pInternalPointer;
|
||||
|
|
|
@ -61,6 +61,8 @@ typedef struct hashtable {
|
|||
} HashTable;
|
||||
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
/* startup/shutdown */
|
||||
ZEND_API int zend_hash_init(HashTable *ht, uint nSize, ulong(*pHashFunction) (char *arKey, uint nKeyLength), void (*pDestructor) (void *pData), int persistent);
|
||||
ZEND_API void zend_hash_destroy(HashTable *ht);
|
||||
|
@ -129,6 +131,7 @@ ZEND_API ulong zend_hash_next_free_element(HashTable *ht);
|
|||
ZEND_API void zend_hash_move_forward(HashTable *ht);
|
||||
ZEND_API void zend_hash_move_backwards(HashTable *ht);
|
||||
ZEND_API int zend_hash_get_current_key(HashTable *ht, char **str_index, ulong *num_index);
|
||||
ZEND_API int zend_hash_get_current_key_type(HashTable *ht);
|
||||
ZEND_API int zend_hash_get_current_data(HashTable *ht, void **pData);
|
||||
ZEND_API void zend_hash_internal_pointer_reset(HashTable *ht);
|
||||
ZEND_API void zend_hash_internal_pointer_end(HashTable *ht);
|
||||
|
@ -150,4 +153,6 @@ void zend_hash_display_pListTail(HashTable *ht);
|
|||
void zend_hash_display(HashTable *ht);
|
||||
#endif
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
#endif /* _HASH_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue