if (pdumper_object_p (p))
{
- enum Lisp_Type type = pdumper_find_object_type (p);
- if (type != PDUMPER_NO_OBJECT)
- mark_object ((type == Lisp_Symbol)
- ? make_lisp_symbol(p)
- : make_lisp_ptr(p, type));
+ int type = pdumper_find_object_type (p);
+ if (pdumper_valid_object_type_p (type))
+ mark_object (type == Lisp_Symbol
+ ? make_lisp_symbol (p)
+ : make_lisp_ptr (p, type));
/* See mark_maybe_object for why we can confidently return. */
return;
}
return offset >= dump_private.header.cold_start;
}
-enum Lisp_Type
+int
pdumper_find_object_type_impl (const void *obj)
{
eassert (pdumper_object_p (obj));
const struct dump_reloc *reloc =
dump_find_relocation (&dump_private.header.object_starts, offset);
return (reloc != NULL && dump_reloc_get_offset (*reloc) == offset)
- ? (enum Lisp_Type) reloc->type
+ ? reloc->type
: PDUMPER_NO_OBJECT;
}
INLINE_HEADER_BEGIN
-#define PDUMPER_NO_OBJECT ((enum Lisp_Type) -1)
+enum { PDUMPER_NO_OBJECT = -1 };
/* Indicate in source code that we're deliberately relying on pdumper
not preserving the given value. Compiles to nothing --- for humans
}
-extern enum Lisp_Type pdumper_find_object_type_impl (const void *obj);
+extern int pdumper_find_object_type_impl (const void *obj);
/* Return the type of the dumped object that starts at OBJ. It is a
programming error to call this routine for an OBJ for which
pdumper_object_p would return false. */
-INLINE _GL_ATTRIBUTE_CONST enum Lisp_Type
+INLINE _GL_ATTRIBUTE_CONST int
pdumper_find_object_type (const void *obj)
{
#ifdef HAVE_PDUMPER
#endif
}
+/* Return true if TYPE is that of a Lisp object.
+ PDUMPER_NO_OBJECT is invalid. */
+INLINE bool
+pdumper_valid_object_type_p (int type)
+{
+ return 0 <= type;
+}
+
/* Return whether OBJ points exactly to the start of some object in
the loaded dump image. It is a programming error to call this
routine for an OBJ for which pdumper_object_p would return
pdumper_object_p_precise (const void *obj)
{
#ifdef HAVE_PDUMPER
- return pdumper_find_object_type (obj) != PDUMPER_NO_OBJECT;
+ return pdumper_valid_object_type_p (pdumper_find_object_type (obj));
#else
(void) obj;
emacs_abort ();