[svn] Check for memmove and implement one if it's missing.

This commit is contained in:
hniksic 2001-11-29 11:43:29 -08:00
parent b6bbc32e14
commit 999388bfa0
5 changed files with 31 additions and 1 deletions

View File

@ -172,7 +172,7 @@ dnl Checks for library functions.
dnl
AC_FUNC_ALLOCA
AC_FUNC_MMAP
AC_CHECK_FUNCS(strdup strstr strcasecmp strncasecmp strpbrk)
AC_CHECK_FUNCS(strdup strstr strcasecmp strncasecmp strpbrk memmove)
AC_CHECK_FUNCS(gettimeofday mktime strptime)
AC_CHECK_FUNCS(strerror snprintf vsnprintf select signal symlink access isatty)
AC_CHECK_FUNCS(uname gethostname usleep)

View File

@ -1,3 +1,7 @@
2001-11-29 Hrvoje Niksic <hniksic@arsdigita.com>
* cmpt.c (memmove): Include a simple memmove implementation.
2001-11-29 Hrvoje Niksic <hniksic@arsdigita.com>
* headers: Guard against header files being included twice.

View File

@ -1226,3 +1226,23 @@ usleep (unsigned long usec)
#endif /* not WINDOWS */
#endif /* not HAVE_USLEEP */
#ifndef HAVE_MEMMOVE
void *
memmove (char *dest, const char *source, unsigned length)
{
char *d0 = dest;
if (source < dest)
/* Moving from low mem to hi mem; start at end. */
for (source += length, dest += length; length; --length)
*--dest = *--source;
else if (source != dest)
{
/* Moving from hi mem to low mem; start at beginning. */
for (; length; --length)
*dest++ = *source++;
}
return (void *) d0;
}
#endif /* not HAVE_MEMMOVE */

View File

@ -144,6 +144,9 @@ char *alloca ();
/* Define if you have the strpbrk function. */
#undef HAVE_STRPBRK
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the strptime function. */
#undef HAVE_STRPTIME

View File

@ -166,6 +166,9 @@ int vsnprintf ();
#ifndef HAVE_USLEEP
int usleep ();
#endif
#ifndef HAVE_MEMMOVE
void *memmove ();
#endif
/* SunOS brain damage -- for some reason, SunOS header files fail to
declare the functions below, which causes all kinds of problems