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
Mark parameter as unused.
[simgrid.git]
/
include
/
xbt
/
dynar.h
diff --git
a/include/xbt/dynar.h
b/include/xbt/dynar.h
index
d211785
..
4f89ad1
100644
(file)
--- a/
include/xbt/dynar.h
+++ b/
include/xbt/dynar.h
@@
-224,16
+224,13
@@
typedef struct xbt_dynar_s {
unsigned long elmsize;
void *data;
void_f_pvoid_t free_f;
unsigned long elmsize;
void *data;
void_f_pvoid_t free_f;
- xbt_mutex_t mutex;
} s_xbt_dynar_t;
static XBT_INLINE void
} s_xbt_dynar_t;
static XBT_INLINE void
-_xbt_dynar_cursor_first(const xbt_dynar_t dynar,
+_xbt_dynar_cursor_first(const xbt_dynar_t dynar
_XBT_GNUC_UNUSED
,
unsigned int *const cursor)
{
unsigned int *const cursor)
{
- /* don't test for dynar!=NULL. The segfault would tell us */
- if (dynar->mutex) /* ie _dynar_lock(dynar) but not public */
- xbt_mutex_acquire(dynar->mutex);
+ /* iterating over a NULL dynar is a no-op (but we don't want to have uninitialized counters) */
//XBT_DEBUG("Set cursor on %p to the first position", (void *) dynar);
*cursor = 0;
//XBT_DEBUG("Set cursor on %p to the first position", (void *) dynar);
*cursor = 0;
@@
-243,11
+240,11
@@
static XBT_INLINE int
_xbt_dynar_cursor_get(const xbt_dynar_t dynar,
unsigned int idx, void *const dst)
{
_xbt_dynar_cursor_get(const xbt_dynar_t dynar,
unsigned int idx, void *const dst)
{
+ if (!dynar) /* iterating over a NULL dynar is a no-op */
+ return FALSE;
if (idx >= dynar->used) {
//XBT_DEBUG("Cursor on %p already on last elem", (void *) dynar);
if (idx >= dynar->used) {
//XBT_DEBUG("Cursor on %p already on last elem", (void *) dynar);
- if (dynar->mutex) /* unlock */
- xbt_mutex_release(dynar->mutex);
return FALSE;
}
// XBT_DEBUG("Cash out cursor on %p at %u", (void *) dynar, *idx);
return FALSE;
}
// XBT_DEBUG("Cash out cursor on %p at %u", (void *) dynar, *idx);