Fix a another Visual C runtime compilation problem.

Branches: main, 11.07

Fix a another Visual C runtime compilation problem.

runtime/mercury_heap_profile.c:
	Avoid arithmetic with void pointers.
	(That's a GNU extension.)
This commit is contained in:
Julien Fischer
2011-07-13 01:22:54 +00:00
parent 64bb189f34
commit 6c44fead50

View File

@@ -72,7 +72,7 @@ MR_increment_table_entry(MR_memprof_table *table,
const MR_Code *proc, const char *type_name, int size)
{
MR_bool found;
int diff;
MR_Integer diff;
MR_memprof_record **node_addr;
MR_memprof_record *node;
@@ -83,7 +83,11 @@ MR_increment_table_entry(MR_memprof_table *table,
node_addr = &table->root;
if (proc != NULL) {
while ((node = *node_addr) != NULL) {
diff = proc - node->proc;
/*
** The casts to MR_Integer are so that we work with C compilers
** that do not support arithmetic with void pointers.
*/
diff = (MR_Integer)proc - (MR_Integer)node->proc;
if (diff < 0) {
node_addr = &node->left;
} else if (diff > 0) {