X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6f48d1a65eeb69ebae17feb1d714db4a60764a51..1acdb6e20d63bf8987e6fbcf65e40949831a206d:/include/xbt/swag.h diff --git a/include/xbt/swag.h b/include/xbt/swag.h index 87bfbb6b5f..5c1ff355ab 100644 --- a/include/xbt/swag.h +++ b/include/xbt/swag.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2004-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2004-2017. 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. */ @@ -7,8 +6,8 @@ /* Warning, this module is done to be efficient and performs tons of cast and dirty things. So avoid using it unless * you really know what you are doing. */ -#ifndef _XBT_SWAG_H -#define _XBT_SWAG_H +#ifndef XBT_SWAG_H +#define XBT_SWAG_H #include "xbt/misc.h" #include "xbt/sysdep.h" /* size_t */ @@ -24,6 +23,8 @@ SG_BEGIN_DECL() * It is basically a fifo but with restrictions so that it can be used as a set. Any operation (add, remove, belongs) * is O(1) and no call to malloc/free is done. * + * @deprecated If you are using C++, you might want to use + * `boost::intrusive::set` instead. */ /** @defgroup XBT_swag_type Swag types @ingroup XBT_swag @@ -65,12 +66,15 @@ typedef struct foo { */ typedef s_xbt_swag_hookup_t *xbt_swag_hookup_t; -typedef struct xbt_swag { +struct xbt_swag { void *head; void *tail; size_t offset; int count; -} s_xbt_swag_t, *xbt_swag_t; +}; +typedef struct xbt_swag s_xbt_swag_t; +typedef struct xbt_swag* xbt_swag_t; + /**< A typical swag */ /* @} */ @@ -110,7 +114,7 @@ XBT_PUBLIC(int) xbt_swag_size(xbt_swag_t swag); #define xbt_swag_getNext(obj, offset) (((xbt_swag_hookup_t)(((char *) (obj)) + (offset)))->next) #define xbt_swag_belongs(obj, swag) (xbt_swag_getNext((obj), (swag)->offset) || (swag)->tail == (obj)) -static XBT_INLINE void *xbt_swag_getFirst(xbt_swag_t swag) +static inline void *xbt_swag_getFirst(xbt_swag_t swag) { return (swag->head); } @@ -189,4 +193,5 @@ static XBT_INLINE void *xbt_swag_getFirst(xbt_swag_t swag) /* @} */ SG_END_DECL() -#endif /* _XBT_SWAG_H */ + +#endif /* XBT_SWAG_H */