X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_api.h;h=2e6efca9fdee5464b5b1b844f033229755133699;hp=052fb1e1c817a9cb92bd5e99ff1930b9e724ba70;hb=f39ea2b145caa37d9614a8a437ffd3d8914b52f0;hpb=82e177a071d35372367f9f5255b3e2c553c8bffd diff --git a/php_http_api.h b/php_http_api.h index 052fb1e..2e6efca 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -191,6 +191,27 @@ static inline void _http_sleep(double s) #endif } +#define http_locate_str _http_locate_str +static inline const char *_http_locate_str(const char *h, size_t h_len, const char *n, size_t n_len) +{ + const char *p, *e; + + if (n_len && h_len) { + e = h + h_len; + do { + if (*h == *n) { + for (p = n; *p == h[p-n]; ++p) { + if (p == n+n_len-1) { + return h; + } + } + } + } while (h++ != e); + } + + return NULL; +} + #define http_locate_body _http_locate_body static inline const char *_http_locate_body(const char *message) {