Dumper should treat opaques as const until it comes to loading them,
where it to uncast unconst explicitly. This can as well go into 21.4,
as it suppresses a bunch of warnings when compiling dumper.c... Well,
a bunch of exactly two warnings, to be specific.
-kkm
2001-05-03 Kirill 'Big K' Katsnelson <kkm(a)dtmx.com>
* lisp.h: (dump_add_opaque): make varaddress parameter const.
* dumper.c (struct pdump_opaque): make varaddress const.
(dump_add_opaque): make varaddress parameter const.
(pdump_load_finish): override const when copying into
info.varaddress.
Index: lisp.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/lisp.h,v
retrieving revision 1.46
diff --unified=3 -r1.46 lisp.h
--- lisp.h 2001/04/30 09:12:03 1.46
+++ lisp.h 2001/05/03 07:58:30
@@ -2163,7 +2163,7 @@
/* dump_add_opaque (&var, size) dumps the opaque static structure `var'. */
#ifdef PDUMP
-void dump_add_opaque (void *, size_t);
+void dump_add_opaque (const void *, size_t);
#else
#define dump_add_opaque(varaddr,size) DO_NOTHING
#endif
Index: dumper.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/dumper.c,v
retrieving revision 1.2
diff --unified=3 -r1.2 dumper.c
--- dumper.c 2001/04/12 18:23:35 1.2
+++ dumper.c 2001/05/03 07:58:10
@@ -44,7 +44,7 @@
typedef struct
{
- void *varaddress;
+ const void *varaddress;
size_t size;
} pdump_opaque;
@@ -84,7 +84,7 @@
/* Mark SIZE bytes at non-heap address VARADDRESS for dumping as is,
without any bit-twiddling. */
void
-dump_add_opaque (void *varaddress, size_t size)
+dump_add_opaque (const void *varaddress, size_t size)
{
pdump_opaque info;
info.varaddress = varaddress;
@@ -1114,7 +1114,7 @@
for (i=0; i<header->nb_opaques; i++)
{
pdump_opaque info = PDUMP_READ_ALIGNED (p, pdump_opaque);
- memcpy (info.varaddress, p, info.size);
+ memcpy ((void*)info.varaddress, p, info.size);
p += info.size;
}