A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Need to have the HAVE_MMAP variable.
[simgrid.git]
/
src
/
xbt
/
heap.c
diff --git
a/src/xbt/heap.c
b/src/xbt/heap.c
index
84eedac
..
2829fe5
100644
(file)
--- a/
src/xbt/heap.c
+++ b/
src/xbt/heap.c
@@
-1,8
+1,7
@@
-/* $Id$ */
-
/* a generic and efficient heap */
/* a generic and efficient heap */
-/* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */
+/* Copyright (c) 2004, 2005, 2007, 2008, 2009, 2010. The SimGrid Team.
+ * All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-128,7
+127,7
@@
void *xbt_heap_pop(xbt_heap_t H)
(void *) realloc(H->items, (H->size) * sizeof(struct xbt_heapItem));
}
(void *) realloc(H->items, (H->size) * sizeof(struct xbt_heapItem));
}
-
H->update_callback ? H->update_callback(max, -1) : NULL
;
+
if(H->update_callback) H->update_callback(max, -1)
;
return max;
}
return max;
}
@@
-199,10
+198,10
@@
static void xbt_heap_maxHeapify(xbt_heap_t H)
struct xbt_heapItem tmp = H->items[i];
H->items[i] = H->items[greatest];
H->items[greatest] = tmp;
struct xbt_heapItem tmp = H->items[i];
H->items[i] = H->items[greatest];
H->items[greatest] = tmp;
-
H->update_callback ? H->update_callback(CONTENT(H, i), i) : NULL
;
+
if(H->update_callback) H->update_callback(CONTENT(H, i), i)
;
i = greatest;
} else {
i = greatest;
} else {
-
H->update_callback ? H->update_callback(CONTENT(H, i), i) : NULL
;
+
if(H->update_callback) H->update_callback(CONTENT(H, i), i)
;
return;
}
}
return;
}
}
@@
-221,10
+220,10
@@
static void xbt_heap_increaseKey(xbt_heap_t H, int i)
struct xbt_heapItem tmp = H->items[i];
H->items[i] = H->items[PARENT(i)];
H->items[PARENT(i)] = tmp;
struct xbt_heapItem tmp = H->items[i];
H->items[i] = H->items[PARENT(i)];
H->items[PARENT(i)] = tmp;
-
H->update_callback ? H->update_callback(CONTENT(H, i), i) : NULL
;
+
if(H->update_callback) H->update_callback(CONTENT(H, i), i)
;
i = PARENT(i);
}
i = PARENT(i);
}
-
H->update_callback ? H->update_callback(CONTENT(H, i), i) : NULL
;
+
if(H->update_callback) H->update_callback(CONTENT(H, i), i)
;
return;
}
return;
}