rename info tests
[m6w6/ext-http] / php_http_strlist.c
index 53ccac942f145e82c8a4c943574d0039d6a75cff..f4571780005bf7d3a61bbf4df1ba3cec4425c031 100644 (file)
@@ -1,7 +1,18 @@
-
-#include "php_http.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)
+/*
+    +--------------------------------------------------------------------+
+    | 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-2014, Michael Wallner <mike@php.net>            |
+    +--------------------------------------------------------------------+
+*/
+
+#include "php_http_api.h"
+
+php_http_strlist_iterator_t *php_http_strlist_iterator_init(php_http_strlist_iterator_t *iter, const char list[], unsigned factor)
 {
        if (!iter) {
                iter = emalloc(sizeof(*iter));
 {
        if (!iter) {
                iter = emalloc(sizeof(*iter));
@@ -14,16 +25,16 @@ PHP_HTTP_API php_http_strlist_iterator_t *php_http_strlist_iterator_init(php_htt
        return iter;
 }
 
        return iter;
 }
 
-PHP_HTTP_API const char *php_http_strlist_iterator_this(php_http_strlist_iterator_t *iter, unsigned *id)
+const char *php_http_strlist_iterator_this(php_http_strlist_iterator_t *iter, unsigned *id)
 {
        if (id) {
 {
        if (id) {
-               *id = iter->major * iter->factor + iter->minor;
+               *id = (iter->major + 1) * iter->factor + iter->minor;
        }
 
        return iter->p;
 }
 
        }
 
        return iter->p;
 }
 
-PHP_HTTP_API const char *php_http_strlist_iterator_next(php_http_strlist_iterator_t *iter)
+const char *php_http_strlist_iterator_next(php_http_strlist_iterator_t *iter)
 {
        if (*iter->p) {
                while (*iter->p) {
 {
        if (*iter->p) {
                while (*iter->p) {
@@ -35,18 +46,19 @@ PHP_HTTP_API const char *php_http_strlist_iterator_next(php_http_strlist_iterato
                if (!*iter->p) {
                        ++iter->p;
                        ++iter->major;
                if (!*iter->p) {
                        ++iter->p;
                        ++iter->major;
+                       iter->minor = 0;
                }
        }
 
     return iter->p;
 }
 
                }
        }
 
     return iter->p;
 }
 
-PHP_HTTP_API void php_http_strlist_iterator_dtor(php_http_strlist_iterator_t *iter)
+void php_http_strlist_iterator_dtor(php_http_strlist_iterator_t *iter)
 {
 
 }
 
 {
 
 }
 
-PHP_HTTP_API void php_http_strlist_iterator_free(php_http_strlist_iterator_t **iter)
+void php_http_strlist_iterator_free(php_http_strlist_iterator_t **iter)
 {
        if (*iter) {
                efree(*iter);
 {
        if (*iter) {
                efree(*iter);
@@ -54,7 +66,7 @@ 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)
+const char *php_http_strlist_find(const char list[], unsigned factor, unsigned item)
 {
        unsigned M = 0, m = 0, major, minor;
        const char *p = &list[0];
 {
        unsigned M = 0, m = 0, major, minor;
        const char *p = &list[0];
@@ -85,3 +97,13 @@ PHP_HTTP_API const char *php_http_strlist_find(const char list[], unsigned facto
 
     return p;
 }
 
     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
+ */
+