/** @brief Dictionary data type (opaque structure) */
typedef struct s_xbt_dict *xbt_dict_t;
+typedef const struct s_xbt_dict* const_xbt_dict_t;
typedef struct s_xbt_dictelm *xbt_dictelm_t;
typedef struct s_xbt_dictelm {
char *key;
/** @brief Cursor on dictionaries (opaque type) */
typedef struct s_xbt_dict_cursor *xbt_dict_cursor_t;
+typedef const struct s_xbt_dict_cursor* const_xbt_dict_cursor_t;
-static inline xbt_dictelm_t xbt_dict_cursor_get_elm(xbt_dict_cursor_t cursor) {
+static inline xbt_dictelm_t xbt_dict_cursor_get_elm(const_xbt_dict_cursor_t cursor)
+{
return cursor->current;
}
*/
/** @brief Dynar data type (opaque type) */
typedef struct xbt_dynar_s *xbt_dynar_t;
+typedef const struct xbt_dynar_s* const_xbt_dynar_t;
XBT_PUBLIC xbt_dynar_t xbt_dynar_new(const unsigned long elm_size, void_f_pvoid_t const free_f);
XBT_PUBLIC void xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f);
void_f_pvoid_t free_f;
} s_xbt_dynar_t;
-static inline int _xbt_dynar_cursor_get(const xbt_dynar_t dynar, unsigned int idx, void* const dst)
+static inline int _xbt_dynar_cursor_get(const_xbt_dynar_t dynar, unsigned int idx, void* const dst)
{
if (!dynar) /* iterating over a NULL dynar is a no-op */
return 0;
/*
* Sanity check to see if the head contains something
*/
-static inline void __cursor_not_null(xbt_dict_cursor_t cursor)
+static inline void __cursor_not_null(const_xbt_dict_cursor_t cursor)
{
xbt_assert(cursor, "Null cursor");
}
return element;
}
-void xbt_dictelm_free(xbt_dict_t dict, xbt_dictelm_t element)
+void xbt_dictelm_free(const_xbt_dict_t dict, xbt_dictelm_t element)
{
if (element) {
char *key = element->key;
}
}
-void xbt_dictelm_set_data(xbt_dict_t dict, xbt_dictelm_t element, void* data)
+void xbt_dictelm_set_data(const_xbt_dict_t dict, xbt_dictelm_t element, void* data)
{
void_f_pvoid_t free_f = dict->free_f;
if (free_f && element->content)
/*####[ Function prototypes ]################################################*/
XBT_PRIVATE xbt_dictelm_t xbt_dictelm_new(const char* key, int key_len, unsigned int hash_code, void* content);
-XBT_PRIVATE void xbt_dictelm_free(xbt_dict_t dict, xbt_dictelm_t element);
-XBT_PRIVATE void xbt_dictelm_set_data(xbt_dict_t dict, xbt_dictelm_t element, void* data);
+XBT_PRIVATE void xbt_dictelm_free(const_xbt_dict_t dict, xbt_dictelm_t element);
+XBT_PRIVATE void xbt_dictelm_set_data(const_xbt_dict_t dict, xbt_dictelm_t element, void* data);
SG_END_DECL