From: Antony Dovgal Date: Fri, 4 Apr 2008 07:47:58 +0000 (+0000) Subject: MFH: fix folding X-Git-Tag: BEFORE_NEW_PARAMETER_PARSE~436 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6157fc76813321778ee0c99ebc9cf6c40eefc99d;p=php MFH: fix folding --- diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 5a2ef83158..66466bcc97 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 const 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); @@ -50,8 +50,9 @@ PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_l return ops; } +/* }}} */ -PHP_HASH_API void php_hash_register_algo(const char *algo, const 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); @@ -60,10 +61,11 @@ PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *o zend_hash_add(&php_hash_hashtable, lower, algo_len + 1, (void*)ops, sizeof(php_hash_ops), NULL); efree(lower); } +/* }}} */ /* Userspace */ -static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename) +static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename) /* {{{ */ { char *algo, *data, *digest; int algo_len, data_len; @@ -120,11 +122,13 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename) RETURN_STRINGL(hex_digest, 2 * ops->digest_size, 0); } } +/* }}} */ /* {{{ proto string hash(string algo, string data[, bool raw_output = false]) Generate a hash of a given input string Returns lowercase hexits by default */ -PHP_FUNCTION(hash) { +PHP_FUNCTION(hash) +{ php_hash_do_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ @@ -132,12 +136,13 @@ PHP_FUNCTION(hash) { /* {{{ proto string hash_file(string algo, string filename[, bool raw_output = false]) Generate a hash of a given file Returns lowercase hexits by default */ -PHP_FUNCTION(hash_file) { +PHP_FUNCTION(hash_file) +{ php_hash_do_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ -static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename) +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; @@ -229,11 +234,13 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename) RETURN_STRINGL(hex_digest, 2 * ops->digest_size, 0); } } +/* }}} */ /* {{{ proto string hash_hmac(string algo, string data, string key[, bool raw_output = false]) Generate a hash of a given input string with a key using HMAC Returns lowercase hexits by default */ -PHP_FUNCTION(hash_hmac) { +PHP_FUNCTION(hash_hmac) +{ php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ @@ -241,7 +248,8 @@ PHP_FUNCTION(hash_hmac) { /* {{{ proto string hash_hmac_file(string algo, string filename, string key[, bool raw_output = false]) Generate a hash of a given file with a key using HMAC Returns lowercase hexits by default */ -PHP_FUNCTION(hash_hmac_file) { +PHP_FUNCTION(hash_hmac_file) +{ php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ @@ -488,7 +496,7 @@ PHP_FUNCTION(hash_algos) /* Module Housekeeping */ -static void php_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) +static void php_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */ { php_hash_data *hash = (php_hash_data*)rsrc->ptr; @@ -506,6 +514,7 @@ static void php_hash_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) } efree(hash); } +/* }}} */ #define PHP_HASH_HAVAL_REGISTER(p,b) php_hash_register_algo("haval" #b "," #p , &php_hash_##p##haval##b##_ops);