From f601cdf35d3e76ffc4927ea35e0f82e72b1ba37f Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 17 Aug 2009 01:25:54 +0000 Subject: [PATCH] * lisp.h (XFLOAT_DATA): Produce an rvalue by adding 0 to the value. (XFLOAT_INIT): New macro for storing a float value. * alloc.c (make_float, make_pure_float): Use XFLOAT_INIT. * fns.c (sxhash): Copy out the value of a float in order to examine its bytes. * dbusbind.c (xd_append_arg): Likewise. --- src/ChangeLog | 8 ++++++++ src/alloc.c | 4 ++-- src/dbusbind.c | 12 +++++++----- src/fns.c | 5 +++-- src/lisp.h | 7 +++++-- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index d9b4984b4d4..9358387d116 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2009-08-17 Ken Raeburn + * lisp.h (XFLOAT_DATA): Produce an rvalue by adding 0 to the + value. + (XFLOAT_INIT): New macro for storing a float value. + * alloc.c (make_float, make_pure_float): Use XFLOAT_INIT. + * fns.c (sxhash): Copy out the value of a float in order to + examine its bytes. + * dbusbind.c (xd_append_arg): Likewise. + * emacs.c (main): Don't call syms_of_data twice. 2009-08-16 Michael Albinus diff --git a/src/alloc.c b/src/alloc.c index c150157ee05..157d768d69d 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2643,7 +2643,7 @@ make_float (float_value) MALLOC_UNBLOCK_INPUT; - XFLOAT_DATA (val) = float_value; + XFLOAT_INIT (val, float_value); eassert (!FLOAT_MARKED_P (XFLOAT (val))); consing_since_gc += sizeof (struct Lisp_Float); floats_consed++; @@ -4850,7 +4850,7 @@ make_pure_float (num) p = (struct Lisp_Float *) pure_alloc (sizeof *p, Lisp_Float); XSETFLOAT (new, p); - XFLOAT_DATA (new) = num; + XFLOAT_INIT (new, num); return new; } diff --git a/src/dbusbind.c b/src/dbusbind.c index a38a9944005..76b0da54205 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -475,11 +475,13 @@ xd_append_arg (dtype, object, iter) } case DBUS_TYPE_DOUBLE: - XD_DEBUG_MESSAGE ("%c %f", dtype, XFLOAT_DATA (object)); - if (!dbus_message_iter_append_basic (iter, dtype, - &XFLOAT_DATA (object))) - XD_SIGNAL2 (build_string ("Unable to append argument"), object); - return; + { + double val = XFLOAT_DATA (object); + XD_DEBUG_MESSAGE ("%c %f", dtype, val); + if (!dbus_message_iter_append_basic (iter, dtype, &val)) + XD_SIGNAL2 (build_string ("Unable to append argument"), object); + return; + } case DBUS_TYPE_STRING: case DBUS_TYPE_OBJECT_PATH: diff --git a/src/fns.c b/src/fns.c index 61abf32138d..562d493b59c 100644 --- a/src/fns.c +++ b/src/fns.c @@ -4604,8 +4604,9 @@ sxhash (obj, depth) case Lisp_Float: { - unsigned char *p = (unsigned char *) &XFLOAT_DATA (obj); - unsigned char *e = p + sizeof XFLOAT_DATA (obj); + double val = XFLOAT_DATA (obj); + unsigned char *p = (unsigned char *) &val; + unsigned char *e = p + sizeof val; for (hash = 0; p < e; ++p) hash = SXHASH_COMBINE (hash, *p); break; diff --git a/src/lisp.h b/src/lisp.h index b71bf524d1e..15de8d9e74f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1377,9 +1377,12 @@ struct Lisp_Float }; #ifdef HIDE_LISP_IMPLEMENTATION -#define XFLOAT_DATA(f) (XFLOAT (f)->u.data_) +#define XFLOAT_DATA(f) (XFLOAT (f)->u.data_ + 0) #else -#define XFLOAT_DATA(f) (XFLOAT (f)->u.data) +#define XFLOAT_DATA(f) (XFLOAT (f)->u.data + 0) +/* This should be used only in alloc.c, which always disables + HIDE_LISP_IMPLEMENTATION. */ +#define XFLOAT_INIT(f,n) (XFLOAT (f)->u.data = (n)) #endif /* A character, declared with the following typedef, is a member -- 2.39.2