summaryrefslogtreecommitdiff
path: root/gutils.c
diff options
context:
space:
mode:
authorSebastian Wilhelmi <wilhelmi@ira.uka.de>1999-07-01 09:30:18 +0000
committerSebastian Wilhelmi <wilhelmi@src.gnome.org>1999-07-01 09:30:18 +0000
commitd610460c2264273b9520c0a932a34431efb56887 (patch)
tree5e2cc6a36c197a7116a8a24771dbc74b728da498 /gutils.c
parentf80d6cc540d1116f5e04f7ea20a54ecf12ea37a6 (diff)
downloadglib-d610460c2264273b9520c0a932a34431efb56887.tar.gz
Added a g_memmove replacement for platforms without memmove, where bcopy
1999-07-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * configure.in, acconfig.h, gutils.c: Added a g_memmove replacement for platforms without memmove, where bcopy can't handle overlapping copies and the corresponding checks, which is taken form the PERL Configure routine. * glib.h: Updated the commentary about g_memmove to be right and more GLib-like. * configure.in: Removed test for rand_r, as it isn't used anymore.
Diffstat (limited to 'gutils.c')
-rw-r--r--gutils.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gutils.c b/gutils.c
index 1c80b150f..513af9f39 100644
--- a/gutils.c
+++ b/gutils.c
@@ -81,6 +81,32 @@ const guint glib_micro_version = GLIB_MICRO_VERSION;
const guint glib_interface_age = GLIB_INTERFACE_AGE;
const guint glib_binary_age = GLIB_BINARY_AGE;
+#if !defined (HAVE_MEMMOVE) && !defined (HAVE_WORKING_BCOPY)
+void
+g_memmove (gpointer dest, gconstpointer src, gulong len)
+{
+ gchar* destptr = dest;
+ const gchar* srcptr = src;
+ if (src + len < dest || dest + len < src)
+ {
+ bcopy (src, dest, len);
+ return;
+ }
+ else if (dest <= src)
+ {
+ while (len--)
+ *(destptr++) = *(srcptr++);
+ }
+ else
+ {
+ destptr += len;
+ srcptr += len;
+ while (len--)
+ *(--destptr) = *(--srcptr);
+ }
+}
+#endif /* !HAVE_MEMMOVE && !HAVE_WORKING_BCOPY */
+
void
g_atexit (GVoidFunc func)
{