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
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git]
/
src
/
xbt
/
swag.c
diff --git
a/src/xbt/swag.c
b/src/xbt/swag.c
index
dcee5ef
..
71f6f00
100644
(file)
--- a/
src/xbt/swag.c
+++ b/
src/xbt/swag.c
@@
-1,4
+1,4
@@
-/* Copyright (c) 2004
, 2005, 2006, 2007, 2008, 2009, 2010
. The SimGrid Team.
+/* Copyright (c) 2004
-2014
. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
@@
-14,14
+14,13
@@
#include "xbt/log.h"
#include "xbt/swag.h"
#include "xbt/log.h"
#include "xbt/swag.h"
-
/** Creates a new swag.
* \param offset where the hookup is located in the structure
* \see xbt_swag_offset
*
* Usage : xbt_swag_new(&obj.setA-&obj);
*/
/** Creates a new swag.
* \param offset where the hookup is located in the structure
* \see xbt_swag_offset
*
* Usage : xbt_swag_new(&obj.setA-&obj);
*/
-
XBT_INLINE
xbt_swag_t xbt_swag_new(size_t offset)
+
inline
xbt_swag_t xbt_swag_new(size_t offset)
{
xbt_swag_t swag = xbt_new0(s_xbt_swag_t, 1);
{
xbt_swag_t swag = xbt_new0(s_xbt_swag_t, 1);
@@
-36,7
+35,7
@@
XBT_INLINE xbt_swag_t xbt_swag_new(size_t offset)
* kilkil a swag but not it's content. If you do not understand why
* xbt_swag_free should not free its content, don't use swags.
*/
* kilkil a swag but not it's content. If you do not understand why
* xbt_swag_free should not free its content, don't use swags.
*/
-
XBT_INLINE
void xbt_swag_free(xbt_swag_t swag)
+
inline
void xbt_swag_free(xbt_swag_t swag)
{
free(swag);
}
{
free(swag);
}
@@
-48,7
+47,7
@@
XBT_INLINE void xbt_swag_free(xbt_swag_t swag)
*
* Usage : xbt_swag_init(swag,&obj.setA-&obj);
*/
*
* Usage : xbt_swag_init(swag,&obj.setA-&obj);
*/
-
XBT_INLINE
void xbt_swag_init(xbt_swag_t swag, size_t offset)
+
inline
void xbt_swag_init(xbt_swag_t swag, size_t offset)
{
swag->tail = NULL;
swag->head = NULL;
{
swag->tail = NULL;
swag->head = NULL;
@@
-63,7
+62,7
@@
XBT_INLINE void xbt_swag_init(xbt_swag_t swag, size_t offset)
* insert (at the head... you probably had a very good reason to do
* that, I hope you know what you're doing) \a obj in \a swag
*/
* insert (at the head... you probably had a very good reason to do
* that, I hope you know what you're doing) \a obj in \a swag
*/
-
XBT_INLINE
void xbt_swag_insert_at_head(void *obj, xbt_swag_t swag)
+
inline
void xbt_swag_insert_at_head(void *obj, xbt_swag_t swag)
{
xbt_assert(!xbt_swag_belongs(obj, swag) || swag->tail,
"This object belongs to an empty swag! Did you correctly initialize the object's hookup?");
{
xbt_assert(!xbt_swag_belongs(obj, swag) || swag->tail,
"This object belongs to an empty swag! Did you correctly initialize the object's hookup?");
@@
-89,7
+88,7
@@
XBT_INLINE void xbt_swag_insert_at_head(void *obj, xbt_swag_t swag)
* insert (at the tail... you probably had a very good reason to do
* that, I hope you know what you're doing) \a obj in \a swag
*/
* insert (at the tail... you probably had a very good reason to do
* that, I hope you know what you're doing) \a obj in \a swag
*/
-
XBT_INLINE
void xbt_swag_insert_at_tail(void *obj, xbt_swag_t swag)
+
inline
void xbt_swag_insert_at_tail(void *obj, xbt_swag_t swag)
{
xbt_assert(!xbt_swag_belongs(obj, swag) || swag->tail,
"This object belongs to an empty swag! Did you correctly initialize the object's hookup?");
{
xbt_assert(!xbt_swag_belongs(obj, swag) || swag->tail,
"This object belongs to an empty swag! Did you correctly initialize the object's hookup?");
@@
-115,7
+114,7
@@
XBT_INLINE void xbt_swag_insert_at_tail(void *obj, xbt_swag_t swag)
*
* removes \a obj from \a swag
*/
*
* removes \a obj from \a swag
*/
-
XBT_INLINE
void *xbt_swag_remove(void *obj, xbt_swag_t swag)
+
inline
void *xbt_swag_remove(void *obj, xbt_swag_t swag)
{
if (!obj)
return NULL;
{
if (!obj)
return NULL;
@@
-178,7
+177,7
@@
void *xbt_swag_extract(xbt_swag_t swag)
* \param swag a swag
* \return the number of objects in \a swag
*/
* \param swag a swag
* \return the number of objects in \a swag
*/
-
XBT_INLINE
int xbt_swag_size(xbt_swag_t swag)
+
inline
int xbt_swag_size(xbt_swag_t swag)
{
return (swag->count);
}
{
return (swag->count);
}
@@
-218,8
+217,9
@@
XBT_TEST_UNIT("basic", test_swag_basic, "Basic usage")
xbt_swag_insert(obj2, setA);
xbt_swag_insert(obj2, setB);
xbt_swag_insert(obj2, setA);
xbt_swag_insert(obj2, setB);
- xbt_swag_remove(obj1, setB);
- /* xbt_swag_remove(obj2, setB); */
+ xbt_test_assert(xbt_swag_remove(NULL, setB) == NULL);
+ xbt_test_assert(xbt_swag_remove(obj1, setB) == obj1);
+ /* xbt_test_assert(xbt_swag_remove(obj2, setB) == obj2); */
xbt_test_add("Traverse set A");
xbt_swag_foreach(obj, setA) {
xbt_test_add("Traverse set A");
xbt_swag_foreach(obj, setA) {