git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5939
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
-/* dict - a generic dictionnary, variation over the B-tree concept */
+/* dict - a generic dictionary, variation over the B-tree concept */
/* Copyright (c) 2003,2004 Martin Quinson. All rights reserved. */
/* Copyright (c) 2003,2004 Martin Quinson. All rights reserved. */
#include "dict_private.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict,xbt,
#include "dict_private.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict,xbt,
- "Dictionaries provide the same functionnalities than hash tables");
+ "Dictionaries provide the same functionalities than hash tables");
/*####[ Private prototypes ]#################################################*/
static xbt_mallocator_t dict_mallocator = NULL;
/*####[ Private prototypes ]#################################################*/
static xbt_mallocator_t dict_mallocator = NULL;
* \return pointer to the destination
* \see xbt_dict_new_ext(), xbt_dict_free()
*
* \return pointer to the destination
* \see xbt_dict_new_ext(), xbt_dict_free()
*
- * Creates and initialize a new dictionnary with a default hashtable size.
+ * Creates and initialize a new dictionary with a default hashtable size.
*/
xbt_dict_t xbt_dict_new(void) {
xbt_dict_t dict;
*/
xbt_dict_t xbt_dict_new(void) {
xbt_dict_t dict;
- * \param dict the dictionnary to be freed
+ * \param dict the dictionary to be freed
*
* Frees a dictionary with all the data
*/
*
* Frees a dictionary with all the data
*/
/* multiply by the 32 bit FNV magic prime mod 2^32 */
hash += (hash<<1) + (hash<<4) + (hash<<7) + (hash<<8) + (hash<<24);
/* multiply by the 32 bit FNV magic prime mod 2^32 */
hash += (hash<<1) + (hash<<4) + (hash<<7) + (hash<<8) + (hash<<24);
- /* xor the bottom with the current octet */
+ /* xor the bottom with the current byte */
hash ^= (unsigned int)*str++;
}
hash ^= (unsigned int)*str++;
}
* \param key_len the size of the \a key
* \param data the data to add in the dict
* \param free_ctn function to call with (\a key as argument) when
* \param key_len the size of the \a key
* \param data the data to add in the dict
* \param free_ctn function to call with (\a key as argument) when
- * \a key is removed from the dictionnary
+ * \a key is removed from the dictionary
*
* Set the \a data in the structure under the \a key, which can be any kind
* of data, as long as its length is provided in \a key_len.
*
* Set the \a data in the structure under the \a key, which can be any kind
* of data, as long as its length is provided in \a key_len.
* \param key the key to set the new data
* \param data the data to add in the dict
* \param free_ctn function to call with (\a key as argument) when
* \param key the key to set the new data
* \param data the data to add in the dict
* \param free_ctn function to call with (\a key as argument) when
- * \a key is removed from the dictionnary
+ * \a key is removed from the dictionary
*
* set the \a data in the structure under the \a key, which is a
* null terminated string.
*
* set the \a data in the structure under the \a key, which is a
* null terminated string.
- * \brief Outputs the content of the structure (debuging purpose)
+ * \brief Outputs the content of the structure (debugging purpose)
*
* \param dict the exibitionist
* \param output a function to dump each data in the tree
*
*
* \param dict the exibitionist
* \param output a function to dump each data in the tree
*
- * Ouputs the content of the structure. (for debuging purpose). \a ouput is a
+ * Outputs the content of the structure. (for debugging purpose). \a output is a
* function to output the data. If NULL, data won't be displayed.
*/
* function to output the data. If NULL, data won't be displayed.
*/
xbt_test_log2("Seen #%d: %s",++i,PRINTF_STR(key));
}
xbt_test_assert2(!data || !strcmp(key,data),
xbt_test_log2("Seen #%d: %s",++i,PRINTF_STR(key));
}
xbt_test_assert2(!data || !strcmp(key,data),
- "Key(%s) != value(%s). Abording",key,data);
+ "Key(%s) != value(%s). Aborting",key,data);
XBT_TEST_UNIT("basic",test_dict_basic,"Basic usage: change, retrieve, traverse"){
XBT_TEST_UNIT("basic",test_dict_basic,"Basic usage: change, retrieve, traverse"){
- xbt_test_add0("Traversal the null dictionnary");
+ xbt_test_add0("Traversal the null dictionary");
- xbt_test_add0("Traversal and search the empty dictionnary");
+ xbt_test_add0("Traversal and search the empty dictionary");
head = xbt_dict_new();
traverse(head);
TRY {
head = xbt_dict_new();
traverse(head);
TRY {
- xbt_test_add0("Traverse the full dictionnary");
+ xbt_test_add0("Traverse the full dictionary");
fill(&head);
count(head, 7);
fill(&head);
count(head, 7);
search(head,"12a");
traverse(head);
search(head,"12a");
traverse(head);
- xbt_test_add0("Free the dictionnary (twice)");
+ xbt_test_add0("Free the dictionary (twice)");
xbt_dict_free(&head);
xbt_dict_free(&head);
xbt_dict_free(&head);
xbt_dict_free(&head);
xbt_dict_set(head,"12a",strdup("12a"),&free);
count(head, 7);
xbt_dict_set(head,"12a",strdup("12a"),&free);
count(head, 7);
- xbt_test_add0("Traverse the resulting dictionnary");
+ xbt_test_add0("Traverse the resulting dictionary");
traverse(head);
/* RETRIEVE */
traverse(head);
/* RETRIEVE */
search(head,"1234");
search(head,"123457");
search(head,"1234");
search(head,"123457");
- xbt_test_add0("Traverse the resulting dictionnary");
+ xbt_test_add0("Traverse the resulting dictionary");
traverse(head);
/* xbt_dict_dump(head,(void (*)(void*))&printf); */
traverse(head);
/* xbt_dict_dump(head,(void (*)(void*))&printf); */
- xbt_test_add0("Free the dictionnary twice");
+ xbt_test_add0("Free the dictionary twice");
xbt_dict_free(&head);
xbt_dict_free(&head);
xbt_dict_free(&head);
xbt_dict_free(&head);
- xbt_test_add0("Traverse the resulting dictionnary");
+ xbt_test_add0("Traverse the resulting dictionary");
- xbt_test_add0("Remove each data manually (traversing the resulting dictionnary each time)");
+ xbt_test_add0("Remove each data manually (traversing the resulting dictionary each time)");
fill(&head);
debuged_remove(head,"12a"); traverse(head);
count(head, 6);
fill(&head);
debuged_remove(head,"12a"); traverse(head);
count(head, 6);
count(head, 0);
traverse(head);
count(head, 0);
traverse(head);
- xbt_test_add0("Free the dictionnary twice");
+ xbt_test_add0("Free the dictionary twice");
xbt_dict_free(&head);
xbt_dict_free(&head);
}
xbt_dict_free(&head);
xbt_dict_free(&head);
}
data = xbt_multidict_get(mdict,keys);
xbt_test_assert2(data && !strcmp((char*)data,key),
data = xbt_multidict_get(mdict,keys);
xbt_test_assert2(data && !strcmp((char*)data,key),
- "Retrieved value (%s) does not match the entrered one (%s)\n",
+ "Retrieved value (%s) does not match the given one (%s)\n",
(char*)data,key);
}
xbt_dict_free(&mdict);
(char*)data,key);
}
xbt_dict_free(&mdict);