/[pcre]/code/trunk/pcre_internal.h
ViewVC logotype

Diff of /code/trunk/pcre_internal.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 96 by nigel, Fri Mar 2 13:10:43 2007 UTC revision 123 by ph10, Mon Mar 12 15:19:06 2007 UTC
# Line 7  Line 7 
7  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
8    
9                         Written by Philip Hazel                         Written by Philip Hazel
10             Copyright (c) 1997-2006 University of Cambridge             Copyright (c) 1997-2007 University of Cambridge
11    
12  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
13  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 189  need to have their names changed. PCRE m Line 189  need to have their names changed. PCRE m
189  option on the command line. */  option on the command line. */
190    
191  #ifdef VPCOMPAT  #ifdef VPCOMPAT
192    #define strlen(s)        _strlen(s)
193  #define strncmp(s1,s2,m) _strncmp(s1,s2,m)  #define strncmp(s1,s2,m) _strncmp(s1,s2,m)
194    #define memcmp(s,c,n)    _memcmp(s,c,n)
195  #define memcpy(d,s,n)    _memcpy(d,s,n)  #define memcpy(d,s,n)    _memcpy(d,s,n)
196  #define memmove(d,s,n)   _memmove(d,s,n)  #define memmove(d,s,n)   _memmove(d,s,n)
197  #define memset(s,c,n)    _memset(s,c,n)  #define memset(s,c,n)    _memset(s,c,n)
# Line 198  option on the command line. */ Line 200  option on the command line. */
200  /* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),  /* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
201  define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY  define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY
202  is set. Otherwise, include an emulating function for those systems that have  is set. Otherwise, include an emulating function for those systems that have
203  neither (there some non-Unix environments where this is the case). This assumes  neither (there some non-Unix environments where this is the case). */
 that all calls to memmove are moving strings upwards in store, which is the  
 case in PCRE. */  
204    
205  #if ! HAVE_MEMMOVE  #if ! HAVE_MEMMOVE
206  #undef  memmove        /* some systems may have a macro */  #undef  memmove        /* some systems may have a macro */
# Line 208  case in PCRE. */ Line 208  case in PCRE. */
208  #define memmove(a, b, c) bcopy(b, a, c)  #define memmove(a, b, c) bcopy(b, a, c)
209  #else  /* HAVE_BCOPY */  #else  /* HAVE_BCOPY */
210  static void *  static void *
211  pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n)  pcre_memmove(void *d, const void *s, size_t n)
212  {  {
213  size_t i;  size_t i;
214  dest += n;  unsigned char *dest = (unsigned char *)d;
215  src += n;  const unsigned char *src = (const unsigned char *)s;
216  for (i = 0; i < n; ++i) *(--dest) =  *(--src);  if (dest > src)
217  return dest;    {
218      dest += n;
219      src += n;
220      for (i = 0; i < n; ++i) *(--dest) = *(--src);
221      return (void *)dest;
222      }
223    else
224      {
225      for (i = 0; i < n; ++i) *dest++ = *src++;
226      return (void *)(dest - n);
227      }
228  }  }
229  #define memmove(a, b, c) pcre_memmove(a, b, c)  #define memmove(a, b, c) pcre_memmove(a, b, c)
230  #endif   /* not HAVE_BCOPY */  #endif   /* not HAVE_BCOPY */

Legend:
Removed from v.96  
changed lines
  Added in v.123

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12