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
Make the context cruft work on windows; mark the pthread layer in context.* as deprec...
[simgrid.git]
/
src
/
xbt
/
swag.c
diff --git
a/src/xbt/swag.c
b/src/xbt/swag.c
index
9cc8cec
..
3c2793a
100644
(file)
--- a/
src/xbt/swag.c
+++ b/
src/xbt/swag.c
@@
-1,7
+1,9
@@
-/* Authors: Arnaud Legrand */
+/* $Id$ */
+
+/* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
/* 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. */
+
*
under the terms of the license (GNU LGPL) which comes with this package. */
/* Warning, this module is done to be efficient and performs tons of
cast and dirty things. So avoid using it unless you really know
/* Warning, this module is done to be efficient and performs tons of
cast and dirty things. So avoid using it unless you really know
@@
-13,11
+15,13
@@
#include "xbt/error.h"
#include "xbt/swag.h"
#include "xbt/error.h"
#include "xbt/swag.h"
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(swag,xbt,"Swag : O(1) set library");
+
#define PREV(obj,offset) xbt_swag_getPrev(obj,offset)
#define NEXT(obj,offset) xbt_swag_getNext(obj,offset)
/*
#define PREV(obj,offset) xbt_swag_getPrev(obj,offset)
#define NEXT(obj,offset) xbt_swag_getNext(obj,offset)
/*
- Usage : xbt_swag_new(&obj.setA-&obj
.setA
);
+ Usage : xbt_swag_new(&obj.setA-&obj);
*/
xbt_swag_t xbt_swag_new(size_t offset)
*/
xbt_swag_t xbt_swag_new(size_t offset)
@@
-29,6
+33,12
@@
xbt_swag_t xbt_swag_new(size_t offset)
return swag;
}
return swag;
}
+
+void xbt_swag_free(xbt_swag_t swag)
+{
+ xbt_free(swag);
+}
+
void xbt_swag_init(xbt_swag_t swag, size_t offset)
{
swag->offset = offset;
void xbt_swag_init(xbt_swag_t swag, size_t offset)
{
swag->offset = offset;
@@
-102,6
+112,7
@@
void *xbt_swag_extract(xbt_swag_t swag)
PREV(swag->head, offset) = NULL;
NEXT(obj, offset) = NULL;
}
PREV(swag->head, offset) = NULL;
NEXT(obj, offset) = NULL;
}
+ (swag->count)--;
return obj;
}
return obj;
}