diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-10-20 23:00:27 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-10-20 23:19:30 +0000 |
commit | 9ef793ba9539b4eddb7893c0df9be6e211d9984f (patch) | |
tree | 7b9374b8dcc8cbbc3b92636b2029f1b55c5e3194 /src/3rdparty/pcre2/src/pcre2_string_utils.c | |
parent | e631e900fd0cd7467b1dccb5fa401afdcd1e41a8 (diff) | |
parent | 7a252ac46780b6145084d8d5ca0549b2de3639cc (diff) |
Merge "Merge remote-tracking branch 'origin/5.11' into 5.12" into refs/staging/5.12
Diffstat (limited to 'src/3rdparty/pcre2/src/pcre2_string_utils.c')
-rw-r--r-- | src/3rdparty/pcre2/src/pcre2_string_utils.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/3rdparty/pcre2/src/pcre2_string_utils.c b/src/3rdparty/pcre2/src/pcre2_string_utils.c index 2a1f282629..d6be01acf5 100644 --- a/src/3rdparty/pcre2/src/pcre2_string_utils.c +++ b/src/3rdparty/pcre2/src/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 * *************************************************/ |