Hello php-i18n,

  i think we should change the api a bit:

From:

typedef struct _key {
        zend_uchar type;
        union {
                char  s[1];   /* Must be last element */
                UChar u[1];   /* Must be last element */
        } arKey;
} HashKey;

typedef struct bucket {
        ulong h;                                                /* Used for 
numeric indexing */
        uint nKeyLength;
        void *pData;
        void *pDataPtr;
        struct bucket *pListNext;
        struct bucket *pListLast;
        struct bucket *pNext;
        struct bucket *pLast;
        HashKey key; /* Must be last element */
} Bucket;

To:

typedef struct _key {
        ulong h;     /* Used for numeric indexing */
        uint nKeyLength;
        zend_uchar type;
        zstr arKey;   /* Must be last element */
} HashKey;

typedef struct bucket {
        void *pData;
        void *pDataPtr;
        struct bucket *pListNext;
        struct bucket *pListLast;
        struct bucket *pNext;
        struct bucket *pLast;
        HashKey key; /* Must be last element */
} Bucket;

So now HashKey matches zend_hash_key just by pure reordering.

Also we should probably change the apply_with_arguments stuff to pass the
tsrm key. That is we'd change from:

typedef int (*apply_func_args_t)(void *pDest, int num_args, va_list args, 
zend_hash_key *hash_key);
ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t 
apply_func, int, ...);


To:

typedef int (*apply_func_args_t)(void *pDest TSRMLS_DC, int num_args, va_list 
args, zend_hash_key *hash_key);
ZEND_API void zend_hash_apply_with_arguments(HashTable *ht TSRMLS_DC, 
apply_func_args_t apply_func, int, ...);

Further more our add_assoc functions currently only allow handling of native
string indexes. This should be changed to allow unicode indexes as well:

ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n);

TO:

ZEND_API int add_assoc_long_ex(zval *arg, zend_uchar type, zst *key, uint 
key_len, long n);

Though maybe it is considerable to just add more functions i don't think
flooding the api is a good idea and prefer to only have one version that can
easily deal with both.

-- 
Best regards,
 Marcus                          mailto:[EMAIL PROTECTED]

-- 
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to