2012-04-16 Paul Eggert <eggert@cs.ucla.edu>
+ Fix minor alloc.c problems found by static checking.
+ * alloc.c (_malloc_internal, _free_internal) [!DOUG_LEA_MALLOC]:
+ New extern decls, to avoid calling undeclared functions.
+ (dont_register_blocks): Define if ((!SYSTEM_MALLOC && !SYNC_INPUT)
+ && GC_MALLOC_CHECK), not if ((GC_MARK_STACK || defined
+ GC_MALLOC_CHECK) && GC_MALLOC_CHECK), to match when it's used.
+ (NEED_MEM_INSERT): New macro.
+ (mem_insert, mem_insert_fixup) [!NEED_MEM_INSERT]: Remove; unused.
+
Fix minor ralloc.c problems found by static checking.
See http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00720.html
* ralloc.c (ALIGNED, ROUND_TO_PAGE, HEAP_PTR_SIZE)
extern size_t _bytes_used;
extern size_t __malloc_extra_blocks;
+extern void *_malloc_internal (size_t);
+extern void _free_internal (void *);
#endif /* not DOUG_LEA_MALLOC */
#ifdef GC_MALLOC_CHECK
enum mem_type allocated_mem_type;
-static int dont_register_blocks;
#endif /* GC_MALLOC_CHECK */
static void mark_maybe_object (Lisp_Object);
static void mark_memory (void *, void *);
static void mem_init (void);
+#if (defined GC_MALLOC_CHECK \
+ ? !defined SYSTEM_MALLOC && !defined SYNC_INPUT \
+ : GC_MARK_STACK)
+# define NEED_MEM_INSERT
static struct mem_node *mem_insert (void *, void *, enum mem_type);
static void mem_insert_fixup (struct mem_node *);
+#endif
static void mem_rotate_left (struct mem_node *);
static void mem_rotate_right (struct mem_node *);
static void mem_delete (struct mem_node *);
# define BYTES_USED _bytes_used
#endif
+#ifdef GC_MALLOC_CHECK
+static int dont_register_blocks;
+#endif
+
static size_t bytes_used_when_reconsidered;
/* Value of _bytes_used, when spare_memory was freed. */
}
+#ifdef NEED_MEM_INSERT
+
/* Insert a new node into the tree for a block of memory with start
address START, end address END, and type TYPE. Value is a
pointer to the node that was inserted. */
mem_root->color = MEM_BLACK;
}
+#endif /* NEED_MEM_INSERT */
+
/* (x) (y)
/ \ / \