From 8fc5d3586acc467d7f340b2e9962d020760878be Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 2 Dec 1997 21:03:14 +0000 Subject: [PATCH] - Added a g_memmove function for SunOS compatability. - Disabled unused gldouble definitions which were a portability problem - owt --- ChangeLog | 13 +++++++++++++ ChangeLog.pre-2-0 | 13 +++++++++++++ ChangeLog.pre-2-10 | 13 +++++++++++++ ChangeLog.pre-2-2 | 13 +++++++++++++ ChangeLog.pre-2-4 | 13 +++++++++++++ ChangeLog.pre-2-6 | 13 +++++++++++++ ChangeLog.pre-2-8 | 13 +++++++++++++ glib/configure.in | 7 ++++--- glib/garray.c | 2 +- glib/glib.h | 13 +++++++++++++ glib/glibconfig.h.in | 4 +++- glib/gstring.c | 4 ++-- gtk/gtktext.c | 18 +++++++++--------- 13 files changed, 123 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index d38fb36434..131f840a56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in. Disabled gldouble, since + it wasn't used anywhere and caused portability problems + +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in, glib/glibconfig.h.in: Added a + g_memmove function which is simply memmove if it exists, otherwise + bcopy.(Should really check if bcopy has the correct semantics, and + create our own memmove is necessary) + * glib/gstring.c, glib/garray.c, gtk/gtktext.c: + memmove => g_memmove + + Sun Nov 30 1997 Jay Painter * gtk/gtknotebook.c: fixed a old bug where all the notebook pages which were not displayed when the notebook widget was realized were diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index d38fb36434..131f840a56 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,16 @@ +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in. Disabled gldouble, since + it wasn't used anywhere and caused portability problems + +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in, glib/glibconfig.h.in: Added a + g_memmove function which is simply memmove if it exists, otherwise + bcopy.(Should really check if bcopy has the correct semantics, and + create our own memmove is necessary) + * glib/gstring.c, glib/garray.c, gtk/gtktext.c: + memmove => g_memmove + + Sun Nov 30 1997 Jay Painter * gtk/gtknotebook.c: fixed a old bug where all the notebook pages which were not displayed when the notebook widget was realized were diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d38fb36434..131f840a56 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in. Disabled gldouble, since + it wasn't used anywhere and caused portability problems + +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in, glib/glibconfig.h.in: Added a + g_memmove function which is simply memmove if it exists, otherwise + bcopy.(Should really check if bcopy has the correct semantics, and + create our own memmove is necessary) + * glib/gstring.c, glib/garray.c, gtk/gtktext.c: + memmove => g_memmove + + Sun Nov 30 1997 Jay Painter * gtk/gtknotebook.c: fixed a old bug where all the notebook pages which were not displayed when the notebook widget was realized were diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index d38fb36434..131f840a56 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,16 @@ +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in. Disabled gldouble, since + it wasn't used anywhere and caused portability problems + +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in, glib/glibconfig.h.in: Added a + g_memmove function which is simply memmove if it exists, otherwise + bcopy.(Should really check if bcopy has the correct semantics, and + create our own memmove is necessary) + * glib/gstring.c, glib/garray.c, gtk/gtktext.c: + memmove => g_memmove + + Sun Nov 30 1997 Jay Painter * gtk/gtknotebook.c: fixed a old bug where all the notebook pages which were not displayed when the notebook widget was realized were diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index d38fb36434..131f840a56 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,16 @@ +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in. Disabled gldouble, since + it wasn't used anywhere and caused portability problems + +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in, glib/glibconfig.h.in: Added a + g_memmove function which is simply memmove if it exists, otherwise + bcopy.(Should really check if bcopy has the correct semantics, and + create our own memmove is necessary) + * glib/gstring.c, glib/garray.c, gtk/gtktext.c: + memmove => g_memmove + + Sun Nov 30 1997 Jay Painter * gtk/gtknotebook.c: fixed a old bug where all the notebook pages which were not displayed when the notebook widget was realized were diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index d38fb36434..131f840a56 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,16 @@ +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in. Disabled gldouble, since + it wasn't used anywhere and caused portability problems + +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in, glib/glibconfig.h.in: Added a + g_memmove function which is simply memmove if it exists, otherwise + bcopy.(Should really check if bcopy has the correct semantics, and + create our own memmove is necessary) + * glib/gstring.c, glib/garray.c, gtk/gtktext.c: + memmove => g_memmove + + Sun Nov 30 1997 Jay Painter * gtk/gtknotebook.c: fixed a old bug where all the notebook pages which were not displayed when the notebook widget was realized were diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d38fb36434..131f840a56 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in. Disabled gldouble, since + it wasn't used anywhere and caused portability problems + +Tue Dec 1 1997 Owen Taylor + * glib/glib.h, glib/configure.in, glib/glibconfig.h.in: Added a + g_memmove function which is simply memmove if it exists, otherwise + bcopy.(Should really check if bcopy has the correct semantics, and + create our own memmove is necessary) + * glib/gstring.c, glib/garray.c, gtk/gtktext.c: + memmove => g_memmove + + Sun Nov 30 1997 Jay Painter * gtk/gtknotebook.c: fixed a old bug where all the notebook pages which were not displayed when the notebook widget was realized were diff --git a/glib/configure.in b/glib/configure.in index b96aa7653c..4820da6282 100644 --- a/glib/configure.in +++ b/glib/configure.in @@ -63,7 +63,8 @@ AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(void *) -AC_C_LONG_DOUBLE +# long doubles were not used, and a portability problem +# AC_C_LONG_DOUBLE AC_C_CONST AC_C_INLINE @@ -71,8 +72,8 @@ AC_CHECK_HEADERS(float.h, AC_DEFINE(HAVE_FLOAT_H)) AC_CHECK_HEADERS(limits.h, AC_DEFINE(HAVE_LIMITS_H)) AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H)) -# Check for strerror and strsignal functions -AC_CHECK_FUNCS(strerror strsignal) +# Check for strerror, strsignal, and memmove functions +AC_CHECK_FUNCS(strerror strsignal memmove) # Check for sys_errlist AC_MSG_CHECKING(sys_errlist) diff --git a/glib/garray.c b/glib/garray.c index 3700848439..b379225653 100644 --- a/glib/garray.c +++ b/glib/garray.c @@ -92,7 +92,7 @@ g_rarray_prepend (GArray *array, { g_array_maybe_expand ((GRealArray*) array, size); - memmove (array->data + size, array->data, array->len); + g_memmove (array->data + size, array->data, array->len); memcpy (array->data, data, size); array->len += size; diff --git a/glib/glib.h b/glib/glib.h index 68496c70fa..aa340672a9 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -257,11 +257,16 @@ typedef unsigned int guint; typedef float gfloat; typedef double gdouble; +/* HAVE_LONG_DOUBLE doesn't work correctly on all platforms. + * Since gldouble isn't used anywhere, just disable it for now */ + +#if 0 #ifdef HAVE_LONG_DOUBLE typedef long double gldouble; #else /* HAVE_LONG_DOUBLE */ typedef double gldouble; #endif /* HAVE_LONG_DOUBLE */ +#endif /* 0 */ typedef void* gpointer; @@ -588,6 +593,14 @@ gchar* g_strdup (const gchar *str); gchar* g_strerror (gint errnum); gchar* g_strsignal (gint signum); +/* We make the assumption that if memmove isn't available, then + * bcopy will do the job. This isn't safe everywhere. (bcopy can't + * necessarily handle overlapping copies) */ +#ifdef HAVE_MEMMOVE +#define g_memmove memmove +#else +#define g_memmove(a,b,c) bcopy(b,a,c) +#endif /* Errors */ diff --git a/glib/glibconfig.h.in b/glib/glibconfig.h.in index 7a7655952b..43c7d66072 100644 --- a/glib/glibconfig.h.in +++ b/glib/glibconfig.h.in @@ -22,7 +22,6 @@ #undef HAVE_DOPRNT #undef HAVE_FLOAT_H #undef HAVE_LIMITS_H -#undef HAVE_LONG_DOUBLE #undef HAVE_SYS_SELECT_H #undef HAVE_STRERROR #undef HAVE_STRSIGNAL @@ -57,6 +56,9 @@ /* Define if you have the strsignal function. */ #undef HAVE_STRSIGNAL +/* Define if you have the memmove function */ +#undef HAVE_MEMMOVE + /* Define if you have the header file. */ #undef HAVE_FLOAT_H diff --git a/glib/gstring.c b/glib/gstring.c index 457d47ebcb..eaadefd0eb 100644 --- a/glib/gstring.c +++ b/glib/gstring.c @@ -286,7 +286,7 @@ g_string_prepend (GString *fstring, gchar *val) g_string_maybe_expand (string, len); - memmove (string->str, string->str + len, string->len); + g_memmove (string->str, string->str + len, string->len); strncpy (string->str, val, len); @@ -304,7 +304,7 @@ g_string_prepend_c (GString *fstring, char c) g_string_maybe_expand (string, 1); - memmove (string->str, string->str + 1, string->len); + g_memmove (string->str, string->str + 1, string->len); string->str[0] = c; diff --git a/gtk/gtktext.c b/gtk/gtktext.c index ae3dd4b5cf..93abccabfc 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -1729,9 +1729,9 @@ move_gap_to_point (GtkText* text) { gint diff = text->point.index - text->gap_position; - memmove (text->text + text->gap_position, - text->text + text->gap_position + text->gap_size, - diff); + g_memmove (text->text + text->gap_position, + text->text + text->gap_position + text->gap_size, + diff); text->gap_position = text->point.index; } @@ -1739,9 +1739,9 @@ move_gap_to_point (GtkText* text) { gint diff = text->gap_position - text->point.index; - memmove (text->text + text->point.index + text->gap_size, - text->text + text->point.index, - diff); + g_memmove (text->text + text->point.index + text->gap_size, + text->text + text->point.index, + diff); text->gap_position = text->point.index; } @@ -1764,9 +1764,9 @@ make_forward_space (GtkText* text, guint len) text->text = (guchar*)g_realloc(text->text, i); } - memmove (text->text + text->gap_position + text->gap_size + 2*len, - text->text + text->gap_position + text->gap_size, - text->text_end - (text->gap_position + text->gap_size)); + g_memmove (text->text + text->gap_position + text->gap_size + 2*len, + text->text + text->gap_position + text->gap_size, + text->text_end - (text->gap_position + text->gap_size)); text->text_end += len*2; text->gap_size += len*2;