diff options
author | Anatol Belski <ab@php.net> | 2018-09-18 14:16:06 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2018-09-21 15:54:14 +0200 |
commit | 91b2b6c65d544f39c45498ebafbab84b81d465b5 (patch) | |
tree | 0e95063199c06b57d48f370903bc765c7491c0c8 /ext/pcre/pcre2lib/pcre2_string_utils.c | |
parent | 72231ed74746f09fb3096761b77cb5130309ca1e (diff) | |
download | php-git-91b2b6c65d544f39c45498ebafbab84b81d465b5.tar.gz |
Upgrade PCRE2 to 10.32
(cherry picked from commit d918e0776b5168aed2707b0ca500589844f0faa8)
Diffstat (limited to 'ext/pcre/pcre2lib/pcre2_string_utils.c')
-rw-r--r-- | ext/pcre/pcre2lib/pcre2_string_utils.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/ext/pcre/pcre2lib/pcre2_string_utils.c b/ext/pcre/pcre2lib/pcre2_string_utils.c index 2a1f282629..d6be01acf5 100644 --- a/ext/pcre/pcre2lib/pcre2_string_utils.c +++ b/ext/pcre/pcre2lib/pcre2_string_utils.c @@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel Original API code Copyright (c) 1997-2012 University of Cambridge - New API code Copyright (c) 2016 University of Cambridge + New API code Copyright (c) 2018 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -51,6 +51,42 @@ functions work only on 8-bit data. */ /************************************************* +* Emulated memmove() for systems without it * +*************************************************/ + +/* This function can make use of bcopy() if it is available. Otherwise do it by +steam, as there some non-Unix environments that lack both memmove() and +bcopy(). */ + +#if !defined(VPCOMPAT) && !defined(HAVE_MEMMOVE) +void * +PRIV(memmove)(void *d, const void *s, size_t n) +{ +#ifdef HAVE_BCOPY +bcopy(s, d, n); +return d; +#else +size_t i; +unsigned char *dest = (unsigned char *)d; +const unsigned char *src = (const unsigned char *)s; +if (dest > src) + { + dest += n; + src += n; + for (i = 0; i < n; ++i) *(--dest) = *(--src); + return (void *)dest; + } +else + { + for (i = 0; i < n; ++i) *dest++ = *src++; + return (void *)(dest - n); + } +#endif /* not HAVE_BCOPY */ +} +#endif /* not VPCOMPAT && not HAVE_MEMMOVE */ + + +/************************************************* * Compare two zero-terminated PCRE2 strings * *************************************************/ |