X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5143d68911fc3fbe0e68e57109a5f0e472898e1c..dbb6a5398ebdb917f1de3acc0d16cd83cd23de71:/src/xbt/dict_multi.c diff --git a/src/xbt/dict_multi.c b/src/xbt/dict_multi.c index c317b81e69..a6f8887301 100644 --- a/src/xbt/dict_multi.c +++ b/src/xbt/dict_multi.c @@ -1,19 +1,22 @@ -/* $Id$ */ - /* dict_multi - dictionnaries of dictionnaries of ... of data */ -/* Copyright (c) 2003-2005 Martin Quinson. All rights reserved. */ +/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. 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. */ +#ifdef XBT_USE_DEPRECATED + #include "dict_private.h" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(dict_multi,dict, "Dictionaries of multiple keys"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_multi, xbt_dict, + "Dictionaries of multiple keys"); -static void _free_dict(void*d) { - VERB1("free dict %p",d); - xbt_dict_free((xbt_dict_t*)&d); +static void _free_dict(void *d) +{ + XBT_VERB("free dict %p", d); + xbt_dict_free((xbt_dict_t *) & d); } /** \brief Insert \e data under all the keys contained in \e keys, providing their sizes in \e lens. @@ -28,50 +31,46 @@ static void _free_dict(void*d) { */ void -xbt_multidict_set_ext(xbt_dict_t mdict, - xbt_dynar_t keys, xbt_dynar_t lens, - void *data, void_f_pvoid_t *free_ctn) { - - xbt_ex_t e; - xbt_dict_t thislevel,nextlevel=NULL; +xbt_multidict_set_ext(xbt_dict_t mdict, + xbt_dynar_t keys, xbt_dynar_t lens, + void *data, void_f_pvoid_t free_ctn) +{ + + xbt_dict_t thislevel, nextlevel = NULL; int i; - + unsigned long int thislen; char *thiskey; - int keys_len=xbt_dynar_length(keys); + int keys_len = xbt_dynar_length(keys); xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens)); - xbt_assert0(keys_len, "Can't set a zero-long key set in a multidict"); + xbt_assert(keys_len, "Can't set a zero-long key set in a multidict"); - DEBUG2("xbt_multidict_set(%p,%d)", mdict, keys_len); + XBT_DEBUG("xbt_multidict_set(%p,%d)", mdict, keys_len); + + for (i = 0, thislevel = mdict; i < keys_len - 1; + i++, thislevel = nextlevel) { - for (i=0 , thislevel = mdict ; - i= 1, "Can't get a zero-long key set in a multidict"); - - DEBUG2("xbt_multidict_get(%p, %ld)", mdict, xbt_dynar_length(keys)); - - for (i=0 , thislevel=mdict ; - i