tony2001 Fri Apr 4 07:47:18 2008 UTC Modified files: /php-src/ext/hash hash.c Log: fix folding http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash.c?r1=1.39&r2=1.40&diff_format=u Index: php-src/ext/hash/hash.c diff -u php-src/ext/hash/hash.c:1.39 php-src/ext/hash/hash.c:1.40 --- php-src/ext/hash/hash.c:1.39 Mon Dec 31 07:12:10 2007 +++ php-src/ext/hash/hash.c Fri Apr 4 07:47:18 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: hash.c,v 1.39 2007/12/31 07:12:10 sebastian Exp $ */ +/* $Id: hash.c,v 1.40 2008/04/04 07:47:18 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -37,7 +37,7 @@ /* 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 @@ 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 @@ 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; @@ -157,11 +159,13 @@ efree(data); } } +/* }}} */ /* {{{ proto string hash(string algo, string data[, bool raw_output = false]) U 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); } /* }}} */ @@ -169,12 +173,13 @@ /* {{{ proto string hash_file(string algo, string filename[, bool raw_output = false]) U 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; @@ -317,11 +322,13 @@ efree(key); } } +/* }}} */ /* {{{ proto string hash_hmac(string algo, string data, string key[, bool raw_output = false]) U 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); } /* }}} */ @@ -329,7 +336,8 @@ /* {{{ proto string hash_hmac_file(string algo, string filename, string key[, bool raw_output = false]) U 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); } /* }}} */ @@ -659,7 +667,7 @@ /* 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; @@ -677,6 +685,7 @@ } efree(hash); } +/* }}} */ #define PHP_HASH_HAVAL_REGISTER(p,b) php_hash_register_algo("haval" #b "," #p , &php_hash_##p##haval##b##_ops);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php