From 64916baf9d485ba6a2546bf79c948c591a233465 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Fri, 17 Feb 2017 16:16:08 +0100 Subject: [PATCH 1/1] xbt_fifo are no longer used, remove the code --- ChangeLog | 3 + doc/doxygen/module-xbt.doc | 2 - doc/doxygen/uhood_arch.doc | 2 +- include/xbt/fifo.h | 118 ------- src/kernel/context/Context.hpp | 1 - src/simix/smx_network.cpp | 8 +- src/surf/network_cm02.hpp | 1 - src/xbt/fifo.c | 559 ------------------------------- src/xbt/fifo_private.h | 31 -- src/xbt/log.c | 1 - src/xbt/xbt_main.cpp | 2 - src/xbt_modinter.h | 2 - tools/cmake/DefinePackages.cmake | 3 - 13 files changed, 8 insertions(+), 725 deletions(-) delete mode 100644 include/xbt/fifo.h delete mode 100644 src/xbt/fifo.c delete mode 100644 src/xbt/fifo_private.h diff --git a/ChangeLog b/ChangeLog index eb0827bbf7..547185db7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,9 @@ SimGrid (3.15) UNRELEASED; urgency=low event from the availability_file changes the avail speed. - Links are now usable from s4u + XBT + - Kill the fifo data container: we don't use it anymore. + -- target_date=March 20 2017 -- Da SimGrid team SimGrid (3.14.159) stable; urgency=low diff --git a/doc/doxygen/module-xbt.doc b/doc/doxygen/module-xbt.doc index fe02319ce0..3f53b3681d 100644 --- a/doc/doxygen/module-xbt.doc +++ b/doc/doxygen/module-xbt.doc @@ -16,7 +16,6 @@ - Data structures - \ref XBT_dynar - \ref XBT_dict - - \ref XBT_fifo - \ref XBT_swag - \ref XBT_heap - @ref xbt_strbuff @@ -67,7 +66,6 @@ @{ */ /** @defgroup XBT_dynar Dynar: generic dynamic array */ /** @defgroup XBT_dict Dict: generic dictionnary */ - /** @defgroup XBT_fifo Fifo: generic workqueue */ /** @defgroup XBT_swag Swag: O(1) set datatype */ /** @defgroup XBT_heap Heap: generic heap data structure */ /** @} */ diff --git a/doc/doxygen/uhood_arch.doc b/doc/doxygen/uhood_arch.doc index 1a97f1d740..9c0e26582e 100644 --- a/doc/doxygen/uhood_arch.doc +++ b/doc/doxygen/uhood_arch.doc @@ -75,7 +75,7 @@ It is a portable library providing some grounding features such as \ref XBT_log, \ref XBT_ex and \ref XBT_config. XBT also encompass the following convenient C data structures: -\ref XBT_dynar, \ref XBT_fifo, \ref XBT_dict, \ref XBT_heap, and +\ref XBT_dynar, \ref XBT_dict, \ref XBT_heap, and \ref XBT_swag. The code is being migrated in C++ so you should probably want to use standard C++ containers instead of them if possible. diff --git a/include/xbt/fifo.h b/include/xbt/fifo.h deleted file mode 100644 index 66ccf3d1ec..0000000000 --- a/include/xbt/fifo.h +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (c) 2004-2007, 2009-2015. 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. */ - -#ifndef _XBT_FIFO_H -#define _XBT_FIFO_H -#include "xbt/misc.h" /* SG_BEGIN_DECL */ -#include "xbt/function_types.h" /* int_f_pvoid_pvoid_t */ - -SG_BEGIN_DECL() - -/** @addtogroup XBT_fifo - * @brief This section describes the API to generic workqueue. - * - * These functions provide the same kind of functionality as dynamic arrays - * but in time O(1). However these functions use malloc/free way too much often. - * - * @deprecated If you are using C++, you might want to used `std::list`, - * `std::deque` or `std::queue instead`. - */ - -/** @defgroup XBT_fifo_cons Fifo constructor and destructor - * @ingroup XBT_fifo - * - * @{ - */ -/** \brief Bucket structure -*/ -typedef struct xbt_fifo_item *xbt_fifo_item_t; - -/** \brief FIFO structure -*/ -typedef struct xbt_fifo *xbt_fifo_t; - -XBT_PUBLIC(xbt_fifo_t) xbt_fifo_new(void); -XBT_PUBLIC(void) xbt_fifo_free(xbt_fifo_t l); -XBT_PUBLIC(void) xbt_fifo_reset(xbt_fifo_t l); -/** @} */ - -/** @defgroup XBT_fifo_perl Fifo perl-like functions - * @ingroup XBT_fifo - * - * @{ - */ -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_push(xbt_fifo_t l, void *t); -XBT_PUBLIC(void *) xbt_fifo_pop(xbt_fifo_t l); -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_unshift(xbt_fifo_t l, void *t); -XBT_PUBLIC(void *) xbt_fifo_shift(xbt_fifo_t l); -XBT_PUBLIC(int) xbt_fifo_size(xbt_fifo_t l); -XBT_PUBLIC(int) xbt_fifo_is_in(xbt_fifo_t l, void *t); -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_search_item(xbt_fifo_t f, int_f_pvoid_pvoid_t cmp_fun, void *closure); -/** @} */ - -/** @defgroup XBT_fifo_direct Direct access to fifo elements - * @ingroup XBT_fifo - * - * @{ - */ - -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_new_item(void); -XBT_PUBLIC(void) xbt_fifo_set_item_content(xbt_fifo_item_t i, void *v); -XBT_PUBLIC(void *) xbt_fifo_get_item_content(xbt_fifo_item_t i); -XBT_PUBLIC(void) xbt_fifo_free_item(xbt_fifo_item_t i); - -XBT_PUBLIC(void) xbt_fifo_push_item(xbt_fifo_t l, xbt_fifo_item_t i); -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_pop_item(xbt_fifo_t i); -XBT_PUBLIC(void) xbt_fifo_unshift_item(xbt_fifo_t l, xbt_fifo_item_t i); -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_shift_item(xbt_fifo_t l); - -XBT_PUBLIC(int) xbt_fifo_remove(xbt_fifo_t l, void *t); -XBT_PUBLIC(int) xbt_fifo_remove_all(xbt_fifo_t l, void *t); -XBT_PUBLIC(void) xbt_fifo_remove_item(xbt_fifo_t l, xbt_fifo_item_t i); - -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_get_first_item(xbt_fifo_t l); -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_get_last_item(xbt_fifo_t l); -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_get_next_item(xbt_fifo_item_t i); -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_get_prev_item(xbt_fifo_item_t i); - -/** - * \brief List iterator - * asserts and stuff - * \param f a list (#xbt_fifo_t) - * \param i a bucket (#xbt_fifo_item_t) - * \param n an object of type \a type. - * \param type the type of objects contained in the fifo - * @hideinitializer - * - * Iterates over the whole list. - */ -#define xbt_fifo_foreach(f,i,n,type) \ - for(i=xbt_fifo_get_first_item(f); \ - ((i)?(n=(type)(xbt_fifo_get_item_content(i)),1):(0)); \ - i=xbt_fifo_get_next_item(i)) - -/** @} */ - -/** @defgroup XBT_fifo_misc Misc fifo functions - * @ingroup XBT_fifo - * - * @{ - */ -XBT_PUBLIC(void **) xbt_fifo_to_array(xbt_fifo_t l); -XBT_PUBLIC(xbt_fifo_t) xbt_fifo_copy(xbt_fifo_t l); -/** @} */ - -/* Deprecated functions: don't use! */ -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_newitem(void); -XBT_PUBLIC(void) xbt_fifo_freeitem(xbt_fifo_item_t l); - -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_getFirstItem(xbt_fifo_t l); -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_getNextItem(xbt_fifo_item_t i); -XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_getPrevItem(xbt_fifo_item_t i); - -SG_END_DECL() - -#endif /* _XBT_FIFO_H */ diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index 7f8544d221..1bbcd8b0a7 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -17,7 +17,6 @@ #include "simgrid/simix.h" #include "surf/surf.h" #include "xbt/base.h" -#include "xbt/fifo.h" #include "xbt/swag.h" #include "xbt/dict.h" #include "xbt/mallocator.h" diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index ce5f2a8c03..89c5a5c85c 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -118,7 +118,7 @@ XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx other_comm->dst_proc=mbox->permanent_receiver.get(); other_comm->ref(); mbox->done_comm_queue.push_back(other_synchro); - XBT_DEBUG("pushing a message into the permanent receive fifo %p, comm %p", mbox, &(other_comm)); + XBT_DEBUG("pushing a message into the permanent receive list %p, comm %p", mbox, &(other_comm)); }else{ mbox->push(this_synchro); @@ -191,15 +191,15 @@ smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void * simgrid::kernel::activity::Comm* this_synchro = new simgrid::kernel::activity::Comm(SIMIX_COMM_RECEIVE); smx_activity_t other_synchro; - //communication already done, get it inside the fifo of completed comms + //communication already done, get it inside the list of completed comms if (mbox->permanent_receiver != nullptr && ! mbox->done_comm_queue.empty()) { XBT_DEBUG("We have a comm that has probably already been received, trying to match it, to skip the communication"); - //find a match in the already received fifo + //find a match in the list of already received comms other_synchro = _find_matching_comm(&mbox->done_comm_queue, SIMIX_COMM_SEND, match_fun, data, this_synchro,/*remove_matching*/true); //if not found, assume the receiver came first, register it to the mailbox in the classical way if (!other_synchro) { - XBT_DEBUG("We have messages in the permanent receive list, but not the one we are looking for, pushing request into fifo"); + XBT_DEBUG("We have messages in the permanent receive list, but not the one we are looking for, pushing request into list"); other_synchro = this_synchro; mbox->push(this_synchro); } else { diff --git a/src/surf/network_cm02.hpp b/src/surf/network_cm02.hpp index e53c1c8710..4020ec6e09 100644 --- a/src/surf/network_cm02.hpp +++ b/src/surf/network_cm02.hpp @@ -10,7 +10,6 @@ #include #include "network_interface.hpp" -#include "xbt/fifo.h" #include "xbt/graph.h" diff --git a/src/xbt/fifo.c b/src/xbt/fifo.c deleted file mode 100644 index 55a6ab02fd..0000000000 --- a/src/xbt/fifo.c +++ /dev/null @@ -1,559 +0,0 @@ -/* Copyright (c) 2004-2014. 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. */ - -#include "xbt/sysdep.h" -#include "xbt/log.h" -#include "xbt/mallocator.h" -#include "fifo_private.h" -#include "src/xbt_modinter.h" - -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_fifo, xbt, "FIFO"); - -static void *fifo_item_mallocator_new_f(void); -#define fifo_item_mallocator_free_f xbt_free_f -static void fifo_item_mallocator_reset_f(void *item); - -static xbt_mallocator_t item_mallocator = NULL; - -/** Constructor - * \return a new fifo - */ -xbt_fifo_t xbt_fifo_new(void) -{ - xbt_fifo_t fifo = xbt_new0(struct xbt_fifo, 1); - - return fifo; -} - -/** Destructor - * \param l poor victim - * - * Free the fifo structure. None of the objects that was in the fifo is however modified. - */ -void xbt_fifo_free(xbt_fifo_t l) -{ - xbt_fifo_reset(l); - xbt_free(l); -} - -/** - * \brief Makes a fifo empty. - * \param l a fifo - * - * None of the objects that was in the fifo is however modified. - */ -void xbt_fifo_reset(xbt_fifo_t l) -{ - xbt_fifo_item_t b = xbt_fifo_get_first_item(l); - - while (b) { - xbt_fifo_item_t tmp = b; - b = b->next; - xbt_fifo_free_item(tmp); - } - l->head = NULL; - l->tail = NULL; -} - -/** Push - * \param l list - * \param t element - * \return the bucket that was just added - * - * Add an object at the tail of the list - */ -xbt_fifo_item_t xbt_fifo_push(xbt_fifo_t l, void *t) -{ - xbt_fifo_item_t new = xbt_fifo_new_item(); - new->content = t; - - xbt_fifo_push_item(l, new); - return new; -} - -/** Pop - * \param l list - * \returns the object stored at the tail of the list. - * - * Removes and returns the object stored at the tail of the list. - * Returns NULL if the list is empty. - */ -void *xbt_fifo_pop(xbt_fifo_t l) -{ - if (l == NULL) - return NULL; - xbt_fifo_item_t item = xbt_fifo_pop_item(l); - if (!item) - return NULL; - - void *content = item->content; - xbt_fifo_free_item(item); - return content; -} - -/** - * \param l list - * \param t element - * \return the bucket that was just added - * - * Add an object at the head of the list - */ -xbt_fifo_item_t xbt_fifo_unshift(xbt_fifo_t l, void *t) -{ - xbt_fifo_item_t new = xbt_fifo_new_item(); - new->content = t; - xbt_fifo_unshift_item(l, new); - return new; -} - -/** Shift - * \param l list - * \returns the object stored at the head of the list. - * - * Removes and returns the object stored at the head of the list. - * Returns NULL if the list is empty. - */ -void *xbt_fifo_shift(xbt_fifo_t l) -{ - if (l == NULL) - return NULL; - xbt_fifo_item_t item = xbt_fifo_shift_item(l); - if (!item) - return NULL; - - void *content = item->content; - xbt_fifo_free_item(item); - return content; -} - -/** Push a bucket - * \param l list - * \param new bucket - * - * Hook up this bucket at the tail of the list - */ -void xbt_fifo_push_item(xbt_fifo_t l, xbt_fifo_item_t new) -{ - xbt_assert((new->next == NULL) && (new->prev == NULL), "Invalid item!"); - (l->count)++; - if (l->head == NULL) { - l->head = new; - l->tail = new; - return; - } - new->prev = l->tail; - new->prev->next = new; - l->tail = new; -} - -/** Pop bucket - * \param l - * \returns the bucket that was at the tail of the list. - * - * Returns NULL if the list was empty. - */ -xbt_fifo_item_t xbt_fifo_pop_item(xbt_fifo_t l) -{ - if (l->tail == NULL) - return NULL; - - xbt_fifo_item_t item = l->tail; - - l->tail = item->prev; - if (l->tail == NULL) - l->head = NULL; - else - l->tail->next = NULL; - - (l->count)--; - - item->prev = NULL; - - return item; -} - -/** Push a bucket - * \param l list - * \param new bucket - * - * Hook up this bucket at the head of the list - */ -void xbt_fifo_unshift_item(xbt_fifo_t l, xbt_fifo_item_t new) -{ - xbt_assert((new->next == NULL) && (new->prev == NULL), "Invalid item!"); - (l->count)++; - if (l->head == NULL) { - l->head = new; - l->tail = new; - return; - } - new->next = l->head; - new->next->prev = new; - l->head = new; -} - -/** Shift bucket - * \param l - * \returns the bucket that was at the head of the list. - * - * Returns NULL if the list was empty. - */ -xbt_fifo_item_t xbt_fifo_shift_item(xbt_fifo_t l) -{ - if (l->head == NULL) - return NULL; - - xbt_fifo_item_t item = l->head; - - l->head = item->next; - if (l->head == NULL) - l->tail = NULL; - else - l->head->prev = NULL; - - (l->count)--; - - item->next = NULL; - - return item; -} - -/** - * \param l - * \param t an objet - * - * removes the first occurrence of \a t from \a l. - * \warning it will not remove duplicates - * \return 1 if an item was removed and 0 otherwise. - */ -int xbt_fifo_remove(xbt_fifo_t l, void *t) -{ - xbt_fifo_item_t current; - xbt_fifo_item_t current_next; - - for (current = l->head; current; current = current_next) { - current_next = current->next; - if (current->content == t) { - /* remove the item */ - xbt_fifo_remove_item(l, current); - xbt_fifo_free_item(current); - /* WILL NOT REMOVE DUPLICATES */ - return 1; - } - } - return 0; -} - -/** - * \param l - * \param t an objet - * - * removes all occurrences of \a t from \a l. - * \return 1 if an item was removed and 0 otherwise. - */ -int xbt_fifo_remove_all(xbt_fifo_t l, void *t) -{ - xbt_fifo_item_t current; - xbt_fifo_item_t current_next; - int res = 0; - - for (current = l->head; current; current = current_next) { - current_next = current->next; - if (current->content == t){ - /* remove the item */ - xbt_fifo_remove_item(l, current); - xbt_fifo_free_item(current); - res = 1; - } - } - return res; -} - -/** - * \param l a list - * \param current a bucket - * - * removes a bucket \a current from the list \a l. This function implicitly - * assumes (and doesn't check!) that this item belongs to this list... - */ -void xbt_fifo_remove_item(xbt_fifo_t l, xbt_fifo_item_t current) -{ - if (l->head == l->tail) { /* special case */ - xbt_assert((current == l->head), "This item is not in the list!"); - l->head = NULL; - l->tail = NULL; - (l->count)--; - current->prev = NULL; - current->next = NULL; - return; - } - - if (current == l->head) { /* It's the head */ - l->head = current->next; - l->head->prev = NULL; - } else if (current == l->tail) { /* It's the tail */ - l->tail = current->prev; - l->tail->next = NULL; - } else { /* It's in the middle */ - current->prev->next = current->next; - current->next->prev = current->prev; - } - (l->count)--; - current->prev = NULL; - current->next = NULL; -} - -/** - * \param f a list - * \param content an object - * \return 1 if \a content is in \a f. - */ -int xbt_fifo_is_in(xbt_fifo_t f, void *content) -{ - xbt_fifo_item_t item = xbt_fifo_get_first_item(f); - while (item) { - if (item->content == content) - return 1; - item = item->next; - } - return 0; -} - -/** - * @brief Search the given element in the fifo using a comparison function - * - * This function allows to search an item with a user provided function instead - * of the pointer comparison used elsewhere in this module. Assume for example that you have a fifo of - * strings. You cannot use xbt_fifo_remove() to remove, say, "TOTO" from it because internally, xbt_fifo_remove() - * will do something like "if (item->content == "toto"), then remove it". And the pointer to the item content and the - * pointer to "toto" will never match. As a solution, the current function provides a way to search elements that are - * semantically equivalent instead of only syntactically. So, removing "Toto" from a fifo can be achieved this way: - * - * @verbatim -int my_comparison_function(void *searched, void *seen) { - return !strcmp(searched, seen); -} - - xbt_fifo_remove_item(fifo, xbt_fifo_search_item(fifo, my_comparison_function, "Toto")); -@endverbatim - * - * \param f a fifo list - * \param cmp_fun the comparison function. Prototype: void *a,void *b -> int. Semantic: returns true iff a=b - * @param closure the element to search. It will be provided as first argument to each call of cmp_fun - * \return the first item matching the comparison function, or NULL if no such item exists - */ -xbt_fifo_item_t xbt_fifo_search_item(xbt_fifo_t f, int_f_pvoid_pvoid_t cmp_fun, void *closure) { - xbt_fifo_item_t item = xbt_fifo_get_first_item(f); - while (item) { - if (cmp_fun(closure, item->content)) - return item; - item = item->next; - } - return NULL; -} - -/** - * \param f a list - * \return a table with the objects stored in \a f. - */ -void **xbt_fifo_to_array(xbt_fifo_t f) -{ - void **array; - xbt_fifo_item_t b; - int i; - - if (f->count == 0) - return NULL; - else - array = xbt_new0(void *, f->count); - - for (i = 0, b = xbt_fifo_get_first_item(f); b; i++, b = b->next) { - array[i] = b->content; - } - return array; -} - -/** - * \param f a list - * \return a copy of \a f. - */ -xbt_fifo_t xbt_fifo_copy(xbt_fifo_t f) -{ - xbt_fifo_t copy = xbt_fifo_new(); - xbt_fifo_item_t b; - - for (b = xbt_fifo_get_first_item(f); b; b = b->next) { - xbt_fifo_push(copy, b->content); - } - return copy; -} - -/* Functions passed to the mallocator constructor */ -static void *fifo_item_mallocator_new_f(void) -{ - return xbt_new(s_xbt_fifo_item_t, 1); -} - -static void fifo_item_mallocator_reset_f(void *item) -{ - /* memset to zero like calloc */ - memset(item, 0, sizeof(s_xbt_fifo_item_t)); -} - -/** Constructor - * \return a new bucket - */ -inline xbt_fifo_item_t xbt_fifo_new_item(void) -{ - return xbt_mallocator_get(item_mallocator); -} - -/** \deprecated Use #xbt_fifo_new_item instead. - */ -inline xbt_fifo_item_t xbt_fifo_newitem(void) -{ - XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_new_item."); - return xbt_fifo_new_item(); -} - -/** - * \param i a bucket - * \param v an object - * - * stores \a v in \a i. - */ -inline void xbt_fifo_set_item_content(xbt_fifo_item_t i, void *v) -{ - xbt_fifo_setItemcontent(i, v); -} - -/** - * \param i a bucket - * \return the object stored \a i. - */ -inline void *xbt_fifo_get_item_content(xbt_fifo_item_t i) -{ - return xbt_fifo_getItemcontent(i); -} - -/** Destructor - * \param b poor victim - * - * Free the bucket but does not modifies the object (if any) that was stored in it. - */ -inline void xbt_fifo_free_item(xbt_fifo_item_t b) -{ - xbt_mallocator_release(item_mallocator, b); -} - -/** Destructor - * \deprecated Use #xbt_fifo_free_item instead. - */ -inline void xbt_fifo_freeitem(xbt_fifo_item_t b) -{ - XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_free_item."); - xbt_fifo_free_item(b); -} - -/** - * \param f a list - * \return the number of buckets in \a f. - */ -inline int xbt_fifo_size(xbt_fifo_t f) -{ - return f->count; -} - -/** - * \param l a list - * \return the head of \a l. - * - * Returns NULL if the list is empty. - */ -inline xbt_fifo_item_t xbt_fifo_get_first_item(xbt_fifo_t l) -{ - return l->head; -} - -/** - * \param l a list - * \return the tail of \a l. - * - * Returns NULL if the list is empty. - */ -inline xbt_fifo_item_t xbt_fifo_get_last_item(xbt_fifo_t l) -{ - return l->tail; -} - -/** \deprecated Use #xbt_fifo_get_first_item instead. - */ -inline xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l) -{ - XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_get_first_item."); - return xbt_fifo_get_first_item(l); -} - -/** - * \param i a bucket - * \return the bucket that comes next - * - * Returns NULL if \a i is the tail of the list. - */ -inline xbt_fifo_item_t xbt_fifo_get_next_item(xbt_fifo_item_t i) -{ - if (i) - return i->next; - return NULL; -} - -/** \deprecated Use #xbt_fifo_get_next_item instead. - */ -xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i) -{ - XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_get_next_item."); - return xbt_fifo_get_next_item(i); -} - -/** - * \param i a bucket - * \return the bucket that is just before \a i. - * - * Returns NULL if \a i is the head of the list. - */ -inline xbt_fifo_item_t xbt_fifo_get_prev_item(xbt_fifo_item_t i) -{ - if (i) - return i->prev; - return NULL; -} - -/** \deprecated Use #xbt_fifo_get_prev_item instead. - */ -xbt_fifo_item_t xbt_fifo_getPrevItem(xbt_fifo_item_t i) -{ - XBT_WARN("This function is deprecated. Use xbt_fifo_get_prev_item."); - return xbt_fifo_get_prev_item(i); -} - -/* Module init/exit handling the fifo item mallocator - * These are internal XBT functions called by xbt_preinit/postexit(). - * It can be used several times to recreate the mallocator, for example when you switch to MC mode - */ -void xbt_fifo_preinit() -{ - item_mallocator = xbt_mallocator_new(65536, fifo_item_mallocator_new_f, - fifo_item_mallocator_free_f, fifo_item_mallocator_reset_f); -} - -void xbt_fifo_postexit() -{ - if (item_mallocator != NULL) { - xbt_mallocator_free(item_mallocator); - item_mallocator = NULL; - } -} -/* @} */ diff --git a/src/xbt/fifo_private.h b/src/xbt/fifo_private.h deleted file mode 100644 index 6d7c3c2bec..0000000000 --- a/src/xbt/fifo_private.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2004, 2009-2010, 2013-2014. 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. */ - -#ifndef _XBT_FIFO_PRIVATE_H -#define _XBT_FIFO_PRIVATE_H -#include "xbt/fifo.h" - -/* Bucket structure */ -typedef struct xbt_fifo_item { - void *content; - struct xbt_fifo_item *next; - struct xbt_fifo_item *prev; -} s_xbt_fifo_item_t; - -/* FIFO structure */ -typedef struct xbt_fifo { - int count; - xbt_fifo_item_t head; - xbt_fifo_item_t tail; -} s_xbt_fifo_t; - -#define xbt_fifo_getFirstitem(l) ((l)?(l)->head:NULL) -#define xbt_fifo_getNextitem(i) ((i)?(i)->next:NULL) -#define xbt_fifo_getPrevitem(i) ((i)?(i)->prev:NULL) -#define xbt_fifo_getItemcontent(i) ((i)?(i)->content:NULL) -#define xbt_fifo_Itemcontent(i) ((i)->content) -#define xbt_fifo_setItemcontent(i,v) (i->content=v) -#endif /* _XBT_FIFO_PRIVATE_H */ diff --git a/src/xbt/log.c b/src/xbt/log.c index 4b359d9cd5..c8659e0123 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -109,7 +109,6 @@ static void xbt_log_connect_categories(void) XBT_LOG_CONNECT(xbt_ex); XBT_LOG_CONNECT(xbt_backtrace); XBT_LOG_CONNECT(xbt_exception); - XBT_LOG_CONNECT(xbt_fifo); XBT_LOG_CONNECT(xbt_graph); XBT_LOG_CONNECT(xbt_heap); XBT_LOG_CONNECT(xbt_lib); diff --git a/src/xbt/xbt_main.cpp b/src/xbt/xbt_main.cpp index 403d4cb126..496cc47da9 100644 --- a/src/xbt/xbt_main.cpp +++ b/src/xbt/xbt_main.cpp @@ -96,7 +96,6 @@ static void xbt_preinit(void) { #endif xbt_log_preinit(); xbt_os_thread_mod_preinit(); - xbt_fifo_preinit(); xbt_dict_preinit(); srand(seed); @@ -110,7 +109,6 @@ static void xbt_postexit(void) { if(!_sg_do_clean_atexit) return; xbt_initialized--; - xbt_fifo_postexit(); xbt_dict_postexit(); xbt_os_thread_mod_postexit(); xbt_dynar_free(&xbt_cmdline); diff --git a/src/xbt_modinter.h b/src/xbt_modinter.h index bb4fd30a27..67e538c86e 100644 --- a/src/xbt_modinter.h +++ b/src/xbt_modinter.h @@ -18,8 +18,6 @@ void xbt_log_preinit(void); void xbt_log_init(int *argc, char **argv); void xbt_log_postexit(void); -void xbt_fifo_preinit(void); -void xbt_fifo_postexit(void); void xbt_dict_preinit(void); void xbt_dict_postexit(void); diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index c9e4e98acd..81feb43200 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -78,7 +78,6 @@ set(EXTRA_DIST src/xbt/backtrace_linux.cpp src/xbt/dict_private.h src/xbt/ex_interface.h - src/xbt/fifo_private.h src/xbt/graph_private.h src/xbt/heap_private.h src/xbt/log_private.h @@ -244,7 +243,6 @@ set(XBT_SRC src/xbt/dynar.cpp src/xbt/ex.cpp src/xbt/exception.cpp - src/xbt/fifo.c src/xbt/graph.c src/xbt/heap.c src/xbt/lib.c @@ -690,7 +688,6 @@ set(headers_to_install include/xbt/exception.hpp include/xbt/backtrace.h include/xbt/backtrace.hpp - include/xbt/fifo.h include/xbt/file.h include/xbt/function_types.h include/xbt/functional.hpp -- 2.20.1