X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=php_http_strlist.c;h=ee46786e84f705511308250039126a5e9857854b;hb=a458b9a25cf0ec9b4d8bde2b22e43c44d71427c8;hp=a00f201f7b7bff1d48d5875157f8308665babfe3;hpb=d3485e3b28336153dca690e872ffe1ddc60fedd2;p=m6w6%2Fext-http diff --git a/php_http_strlist.c b/php_http_strlist.c index a00f201..ee46786 100644 --- a/php_http_strlist.c +++ b/php_http_strlist.c @@ -1,3 +1,14 @@ +/* + +--------------------------------------------------------------------+ + | PECL :: http | + +--------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted provided that the conditions mentioned | + | in the accompanying LICENSE file are met. | + +--------------------------------------------------------------------+ + | Copyright (c) 2004-2011, Michael Wallner | + +--------------------------------------------------------------------+ +*/ #include "php_http.h" @@ -56,9 +67,16 @@ PHP_HTTP_API void php_http_strlist_iterator_free(php_http_strlist_iterator_t **i PHP_HTTP_API const char *php_http_strlist_find(const char list[], unsigned factor, unsigned item) { - unsigned M = 0, m = 0, major = (item / factor) - 1, minor = (item % factor); + unsigned M = 0, m = 0, major, minor; const char *p = &list[0]; + if (factor) { + major = (item / factor) - 1; + minor = item % factor; + } else { + major = 0; + minor = item; + } while (*p && major != M++) { while (*p) { while (*p) { @@ -78,3 +96,13 @@ PHP_HTTP_API const char *php_http_strlist_find(const char list[], unsigned facto return p; } + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ +