X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_strlist.c;h=3a52f3bd9f816c2c199ea258573d158a4ecebe2d;hp=53ccac942f145e82c8a4c943574d0039d6a75cff;hb=8191c55421fb6ecc86185608a8b0510da1525e1e;hpb=df06e2dbf48a3b0d96f2c62071c1b5fc907a98d0 diff --git a/php_http_strlist.c b/php_http_strlist.c index 53ccac9..3a52f3b 100644 --- a/php_http_strlist.c +++ b/php_http_strlist.c @@ -1,5 +1,16 @@ - -#include "php_http.h" +/* + +--------------------------------------------------------------------+ + | 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_api.h" PHP_HTTP_API php_http_strlist_iterator_t *php_http_strlist_iterator_init(php_http_strlist_iterator_t *iter, const char list[], unsigned factor) { @@ -17,7 +28,7 @@ PHP_HTTP_API php_http_strlist_iterator_t *php_http_strlist_iterator_init(php_htt PHP_HTTP_API const char *php_http_strlist_iterator_this(php_http_strlist_iterator_t *iter, unsigned *id) { if (id) { - *id = iter->major * iter->factor + iter->minor; + *id = (iter->major + 1) * iter->factor + iter->minor; } return iter->p; @@ -35,6 +46,7 @@ PHP_HTTP_API const char *php_http_strlist_iterator_next(php_http_strlist_iterato if (!*iter->p) { ++iter->p; ++iter->major; + iter->minor = 0; } } @@ -85,3 +97,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 + */ +