forbidden to override these deprecated methods in a derived class. Please use
the new names immediately if you need to override them.
+XBT:
+- Remove unused parameter 'free_ctn' for xbt_dict_set() and xbt_dict_set_ext().
+
Fixed bugs (FG#.. -> framagit bugs; FG!.. -> framagit merge requests):
- GH#31: [MC] please provide an option to make MPI_Send asynchronous
- GH#305: Unscheduled tasks are still excuted
for (int i = 0; i < (data->n - 1); i++)
data->percentage[i] = atof(strtok_r(NULL, "\t", &saveptr));
- xbt_dict_set(mydict, key, data, NULL);
+ xbt_dict_set(mydict, key, data);
}
fclose(fpInput);
}
data->percentage[i] = atof(strtok_r(NULL, "\t", &saveptr));
}
- xbt_dict_set(mydict, key, data, NULL);
+ xbt_dict_set(mydict, key, data);
}
fclose(fpInput);
}
char buff[512];
sprintf(buff,"some very precious data");
- xbt_dict_set(mydict,"my data", strdup(buff), NULL);
+ xbt_dict_set(mydict,"my data", strdup(buff));
sprintf(buff,"another good stuff");
- xbt_dict_set(mydict,"my data", strdup(buff), NULL); // previous data gets erased (and freed) by second add
+ xbt_dict_set(mydict,"my data", strdup(buff)); // previous data gets erased (and freed) by second add
@endverbatim
*/
* @{
*/
-XBT_PUBLIC void xbt_dict_set(xbt_dict_t dict, const char* key, void* data, void_f_pvoid_t free_ctn);
+XBT_PUBLIC void xbt_dict_set(xbt_dict_t dict, const char* key, void* data);
XBT_PUBLIC void* xbt_dict_get(xbt_dict_t dict, const char* key);
XBT_PUBLIC void* xbt_dict_get_or_null(xbt_dict_t dict, const char* key);
XBT_PUBLIC char* xbt_dict_get_key(xbt_dict_t dict, const void* data);
*
* @{
*/
-XBT_PUBLIC void xbt_dict_set_ext(xbt_dict_t dict, const char* key, int key_len, void* data, void_f_pvoid_t free_ctn);
+XBT_PUBLIC void xbt_dict_set_ext(xbt_dict_t dict, const char* key, int key_len, void* data);
XBT_PUBLIC void* xbt_dict_get_ext(xbt_dict_t dict, const char* key, int key_len);
XBT_PUBLIC void* xbt_dict_get_or_null_ext(xbt_dict_t dict, const char* key, int key_len);
XBT_PUBLIC void xbt_dict_remove_ext(xbt_dict_t dict, const char* key, int key_len);
for (auto const& entry : *content) {
sg_size_t* psize = new sg_size_t;
*psize = entry.second;
- xbt_dict_set(content_as_dict, entry.first.c_str(), psize, nullptr);
+ xbt_dict_set(content_as_dict, entry.first.c_str(), psize);
}
return content_as_dict;
}
xbt_assert((host != nullptr), "Invalid parameters");
xbt_dict_t contents = xbt_dict_new_homogeneous(nullptr);
for (auto const& elm : host->get_mounted_storages())
- xbt_dict_set(contents, elm.first.c_str(), sg_storage_get_content(elm.second), nullptr);
+ xbt_dict_set(contents, elm.first.c_str(), sg_storage_get_content(elm.second));
return contents;
}
if (props == nullptr)
return nullptr;
for (auto const& kv : *props) {
- xbt_dict_set(as_dict, kv.first.c_str(), xbt_strdup(kv.second.c_str()), nullptr);
+ xbt_dict_set(as_dict, kv.first.c_str(), xbt_strdup(kv.second.c_str()));
}
return as_dict;
}
for (auto const& elm : host->get_mounted_storages()) {
const char* mount_name = elm.first.c_str();
sg_storage_t storage = elm.second;
- xbt_dict_set(res, mount_name, (void*)storage->get_cname(), nullptr);
+ xbt_dict_set(res, mount_name, (void*)storage->get_cname());
}
return res;
if (props == nullptr)
return nullptr;
for (auto const& elm : *props) {
- xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()), nullptr);
+ xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()));
}
return as_dict;
}
void sg_zone_get_sons(sg_netzone_t netzone, xbt_dict_t whereto)
{
for (auto const& elem : netzone->get_children()) {
- xbt_dict_set(whereto, elem->get_cname(), static_cast<void*>(elem), nullptr);
+ xbt_dict_set(whereto, elem->get_cname(), static_cast<void*>(elem));
}
}
if (props == nullptr)
return nullptr;
for (auto const& elm : *props) {
- xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()), nullptr);
+ xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()));
}
return as_dict;
}
* @param key the key to set the new data
* @param key_len the size of the @a key
* @param data the data to add in the dict
- * @param free_ctn unused parameter (kept for compatibility)
*
* 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.
*/
-void xbt_dict_set_ext(xbt_dict_t dict, const char* key, int key_len, void* data,
- XBT_ATTRIB_UNUSED void_f_pvoid_t free_ctn)
+void xbt_dict_set_ext(xbt_dict_t dict, const char* key, int key_len, void* data)
{
unsigned int hash_code = xbt_str_hash_ext(key, key_len);
* @param dict the dict
* @param key the key to set the new data
* @param data the data to add in the dict
- * @param free_ctn unused parameter (kept for compatibility)
*
* set the @a data in the structure under the @a key, which is a null terminated string.
*/
-void xbt_dict_set(xbt_dict_t dict, const char *key, void *data, void_f_pvoid_t free_ctn)
+void xbt_dict_set(xbt_dict_t dict, const char* key, void* data)
{
- xbt_dict_set_ext(dict, key, strlen(key), data, free_ctn);
+ xbt_dict_set_ext(dict, key, strlen(key), data);
}
/**
INFO("Add " << STR(data_to_fill) << " under " << STR(key));
- xbt_dict_set(head, key, data, nullptr);
+ xbt_dict_set(head, key, data);
}
static void debugged_add(xbt_dict_t head, const char* key)
head = new_fixture();
count_check_get_key(head, 7);
INFO("Change 123 to 'Changed 123'");
- xbt_dict_set(head, "123", xbt_strdup("Changed 123"), nullptr);
+ xbt_dict_set(head, "123", xbt_strdup("Changed 123"));
count_check_get_key(head, 7);
INFO("Change 123 back to '123'");
- xbt_dict_set(head, "123", xbt_strdup("123"), nullptr);
+ xbt_dict_set(head, "123", xbt_strdup("123"));
count_check_get_key(head, 7);
INFO("Change 12a to 'Dummy 12a'");
- xbt_dict_set(head, "12a", xbt_strdup("Dummy 12a"), nullptr);
+ xbt_dict_set(head, "12a", xbt_strdup("Dummy 12a"));
count_check_get_key(head, 7);
INFO("Change 12a to '12a'");
- xbt_dict_set(head, "12a", xbt_strdup("12a"), nullptr);
+ xbt_dict_set(head, "12a", xbt_strdup("12a"));
count_check_get_key(head, 7);
INFO("Traverse the resulting dictionary");
xbt_dict_t head = new_fixture();
INFO("Store nullptr under 'null'");
- xbt_dict_set(head, "null", nullptr, nullptr);
+ xbt_dict_set(head, "null", nullptr);
search_ext(head, "null", nullptr);
INFO("Check whether I see it while traversing...");
data = (char*)xbt_dict_get_or_null(head, key);
} while (data != nullptr);
- xbt_dict_set(head, key, key, nullptr);
+ xbt_dict_set(head, key, key);
data = (char*)xbt_dict_get(head, key);
REQUIRE(not strcmp(key, data)); // Retrieved value != Injected value
char* key = (char*)xbt_malloc(10);
snprintf(key, 10, "%d", j);
- xbt_dict_set(head, key, key, nullptr);
+ xbt_dict_set(head, key, key);
}
INFO("Count the elements (retrieving the key and data for each)");
INFO("Insert elements");
for (int i = 0; i < count; ++i)
- xbt_dict_set_ext(dict, (char*)&i, sizeof(i), (void*)(intptr_t)i, nullptr);
+ xbt_dict_set_ext(dict, (char*)&i, sizeof(i), (void*)(intptr_t)i);
REQUIRE(xbt_dict_size(dict) == (unsigned)count); // Bad number of elements in the dictionary
INFO("Check elements");
// Add the peers the tracker gave us to our peer list.
xbt_dynar_foreach (data->peers, i, peer_id) {
if (peer_id != peer->id)
- xbt_dict_set_ext(peer->peers, (char*)&peer_id, sizeof(int), connection_new(peer_id), NULL);
+ xbt_dict_set_ext(peer->peers, (char*)&peer_id, sizeof(int), connection_new(peer_id));
}
success = 1;
// free the communication and the task
{
if ((remote_peer->interested != 0) && (remote_peer->choked_upload == 0)) {
// add in the active peers set
- xbt_dict_set_ext(peer->active_peers, (char*)&remote_peer->id, sizeof(int), remote_peer, NULL);
+ xbt_dict_set_ext(peer->active_peers, (char*)&remote_peer->id, sizeof(int), remote_peer);
} else if (xbt_dict_get_or_null_ext(peer->active_peers, (char*)&remote_peer->id, sizeof(int))) {
xbt_dict_remove_ext(peer->active_peers, (char*)&remote_peer->id, sizeof(int));
}
case MESSAGE_HANDSHAKE:
// Check if the peer is in our connection list.
if (remote_peer == 0) {
- xbt_dict_set_ext(peer->peers, (char*)&message->peer_id, sizeof(int), connection_new(message->peer_id), NULL);
+ xbt_dict_set_ext(peer->peers, (char*)&message->peer_id, sizeof(int), connection_new(message->peer_id));
send_handshake(peer, message->mailbox);
}
// Send our bitfield to the peer
if (chosen_peer != NULL) {
xbt_assert((chosen_peer->choked_upload), "Tries to unchoked an unchoked peer");
chosen_peer->choked_upload = 0;
- xbt_dict_set_ext(peer->active_peers, (char*)&chosen_peer->id, sizeof(int), chosen_peer, NULL);
+ xbt_dict_set_ext(peer->active_peers, (char*)&chosen_peer->id, sizeof(int), chosen_peer);
chosen_peer->last_unchoke = MSG_get_clock();
XBT_DEBUG("(%d) Sending a UNCHOKE to %d", peer->id, chosen_peer->id);
update_active_peers_set(peer, chosen_peer);