diff options
author | Antony Dovgal <tony2001@php.net> | 2006-08-08 09:41:09 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2006-08-08 09:41:09 +0000 |
commit | b8617a6183cffb7a028fae686819b49a3480a449 (patch) | |
tree | 74bbeef3770f1e977ff2bf47797401597a161c62 | |
parent | 05206b42d86b9ddd99d16157576959225fecddae (diff) | |
download | php-git-b8617a6183cffb7a028fae686819b49a3480a449.tar.gz |
add zend_memrchr()
-rw-r--r-- | Zend/zend_operators.h | 23 | ||||
-rw-r--r-- | configure.in | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index cf21c87c71..ba86413044 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -160,6 +160,29 @@ zend_memnstr(char *haystack, char *needle, int needle_len, char *end) return NULL; } +#ifdef HAVE_MEMRCHR +# ifndef __USE_GNU +# define __USE_GNU +# endif + +#include <string.h> +#define zend_memrchr memrchr + +#else + +static inline void *zend_memrchr(const void *s, int c, size_t n) +{ + register unsigned char *e = (unsigned char *)s + n; + + for (e--; e >= (unsigned char *)s; e--) { + if (*e == (unsigned char)c) { + return (void *)e; + } + } + + return NULL; +} +#endif BEGIN_EXTERN_C() ZEND_API int increment_function(zval *op1); diff --git a/configure.in b/configure.in index f9df413865..242b25ab2e 100644 --- a/configure.in +++ b/configure.in @@ -491,6 +491,7 @@ lchown \ lrand48 \ memcpy \ memmove \ +memrchr \ mkstemp \ mmap \ nl_langinfo \ |