Skip to content

Commit 5db5b7a

Browse files
committed
Fix const qualifier warning, don't put side-effect within assert
1 parent 690e0ac commit 5db5b7a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎ext/hash/hash.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *o
122122
}
123123
/* }}} */
124124

125-
PHP_HASH_API int php_hash_copy(const void *ops, void *orig_context, void *dest_context) /* {{{ */
125+
PHP_HASH_API int php_hash_copy(const void *ops, const void *orig_context, void *dest_context) /* {{{ */
126126
{
127127
php_hash_ops *hash_ops = (php_hash_ops *)ops;
128128

@@ -498,7 +498,7 @@ static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops
498498
}
499499

500500
static inline void php_hash_hmac_round_with_copy(unsigned char *final, const php_hash_ops *ops, const void *base_context, void *context, const unsigned char *data, const zend_long data_size) {
501-
ZEND_ASSERT(SUCCESS == ops->hash_copy(ops, base_context, context));
501+
ops->hash_copy(ops, base_context, context);
502502
ops->hash_update(context, data, data_size);
503503
ops->hash_final(final, context);
504504
}

‎ext/hash/php_hash.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ typedef struct _php_hashcontext_object php_hashcontext_object;
3434
typedef void (*php_hash_init_func_t)(void *context, HashTable *args);
3535
typedef void (*php_hash_update_func_t)(void *context, const unsigned char *buf, size_t count);
3636
typedef void (*php_hash_final_func_t)(unsigned char *digest, void *context);
37-
typedef int (*php_hash_copy_func_t)(const void *ops, void *orig_context, void *dest_context);
37+
typedef int (*php_hash_copy_func_t)(const void *ops, const void *orig_context, void *dest_context);
3838
typedef int (*php_hash_serialize_func_t)(const php_hashcontext_object *hash, zend_long *magic, zval *zv);
3939
typedef int (*php_hash_unserialize_func_t)(php_hashcontext_object *hash, zend_long magic, const zval *zv);
4040

@@ -147,7 +147,7 @@ extern zend_module_entry hash_module_entry;
147147
extern PHP_HASH_API zend_class_entry *php_hashcontext_ce;
148148
PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(zend_string *algo);
149149
PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *ops);
150-
PHP_HASH_API int php_hash_copy(const void *ops, void *orig_context, void *dest_context);
150+
PHP_HASH_API int php_hash_copy(const void *ops, const void *orig_context, void *dest_context);
151151
PHP_HASH_API int php_hash_serialize(const php_hashcontext_object *context, zend_long *magic, zval *zv);
152152
PHP_HASH_API int php_hash_unserialize(php_hashcontext_object *context, zend_long magic, const zval *zv);
153153
PHP_HASH_API int php_hash_serialize_spec(const php_hashcontext_object *context, zval *zv, const char *spec);

0 commit comments

Comments
 (0)