summaryrefslogtreecommitdiff
path: root/ext/hash/hash.c
diff options
context:
space:
mode:
authorNuno Lopes <nlopess@php.net>2007-01-08 22:29:25 +0000
committerNuno Lopes <nlopess@php.net>2007-01-08 22:29:25 +0000
commitec66c5be3d62b90c0031906f2cbfb51efe62134e (patch)
treedd2333697a22545283948c660c4d00d4ff40958f /ext/hash/hash.c
parentcdfed7f75713bca9e7703019bbe8c329a8f397a2 (diff)
downloadphp-git-ec66c5be3d62b90c0031906f2cbfb51efe62134e.tar.gz
make the hash_ops structures const and save some memory
# ram memory is so expensive these days...
Diffstat (limited to 'ext/hash/hash.c')
-rw-r--r--ext/hash/hash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 1f77324a60..bb719e295d 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -37,7 +37,7 @@ HashTable php_hash_hashtable;
/* Hash Registry Access */
-PHP_HASH_API php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len)
+PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len)
{
php_hash_ops *ops;
char *lower = estrndup(algo, algo_len);
@@ -51,13 +51,13 @@ PHP_HASH_API php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len)
return ops;
}
-PHP_HASH_API void php_hash_register_algo(const char *algo, php_hash_ops *ops)
+PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *ops)
{
int algo_len = strlen(algo);
char *lower = estrndup(algo, algo_len);
zend_str_tolower(lower, algo_len);
- zend_hash_add(&php_hash_hashtable, lower, algo_len + 1, ops, sizeof(php_hash_ops), NULL);
+ zend_hash_add(&php_hash_hashtable, lower, algo_len + 1, (void*)ops, sizeof(php_hash_ops), NULL);
efree(lower);
}
@@ -68,7 +68,7 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename)
char *algo, *data, *digest;
int algo_len, data_len;
zend_bool raw_output = 0;
- php_hash_ops *ops;
+ const php_hash_ops *ops;
void *context;
php_stream *stream = NULL;
@@ -142,7 +142,7 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename)
char *algo, *data, *digest, *key, *K;
int algo_len, data_len, key_len, i;
zend_bool raw_output = 0;
- php_hash_ops *ops;
+ const php_hash_ops *ops;
void *context;
php_stream *stream = NULL;
@@ -255,7 +255,7 @@ PHP_FUNCTION(hash_init)
int algo_len, key_len = 0, argc = ZEND_NUM_ARGS();
long options = 0;
void *context;
- php_hash_ops *ops;
+ const php_hash_ops *ops;
php_hash_data *hash;
if (zend_parse_parameters(argc TSRMLS_CC, "s|ls", &algo, &algo_len, &options, &key, &key_len) == FAILURE) {