From: Kristian Köhntopp Date: Thu, 29 Jun 2000 14:07:10 +0000 (+0000) Subject: ezmlm_hash() function also available for php4. X-Git-Tag: PRE_METHOD_CALL_SEPERATE_FIX_PATCH~102 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02cad904ee2254f8a0e3fc8bf6b7d5ddd6200434;p=php ezmlm_hash() function also available for php4. --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 717a776339..91ce4a2de3 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -455,6 +455,7 @@ function_entry basic_functions[] = { /* functions from mail.c */ PHP_FE(mail, NULL) + PHP_FE(ezmlm_hash, NULL) /* functions from syslog.c */ PHP_FE(openlog, NULL) diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 4e71e33320..16753a7c5c 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -38,6 +38,37 @@ ZEND_GET_MODULE(odbc) #endif +/* {{{ proto int ezmlm_hash(string addr) + Calculate EZMLM list hash value. */ +PHP_FUNCTION(ezmlm_hash) +{ + pval **pstr = NULL; + char *str=NULL; + unsigned long h = 5381L; + int j, l; + + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pstr) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_string_ex(pstr); + if ((*pstr)->value.str.val) { + str = (*pstr)->value.str.val; + } else { + php_error(E_WARNING, "Must give string parameter to ezmlm_hash()"); + RETURN_FALSE; + } + + l = strlen(str); + for (j=0; j