Skip to content

Commit

Permalink
Merge pull request #5498 from lplewa/stable-1.12
Browse files Browse the repository at this point in the history
masync update for stable 1.12
  • Loading branch information
lplewa committed Aug 25, 2022
2 parents 9081161 + c39491d commit b1d7bb0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion src/deps/miniasync/examples/hashmap/hashmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ hashmap_new(size_t capacity)
return NULL;
}

struct hashmap *hm = malloc(sizeof(struct hashmap) * capacity);
struct hashmap *hm = malloc(sizeof(struct hashmap));
if (hm == NULL) {
return NULL;
}
Expand Down Expand Up @@ -1149,13 +1149,26 @@ main(void)
char other_val[] = "Coffee";

struct hashmap *hm = hashmap_new(4);
if (hm == NULL) {
printf("failed to allocate a new hashmap.\n");
return 1;
}

/* Create a runtime instance for efficient future polling */
struct runtime *r = runtime_new();
if (r == NULL) {
hashmap_delete(hm);

printf("failed to allocate a new runtime.\n");
return 1;
}

/* Create a thread mover to be used for data move operations */
struct data_mover_threads *dmt = data_mover_threads_default();
if (dmt == NULL) {
runtime_delete(r);
hashmap_delete(hm);

printf("failed to allocate data mover.\n");
return 1;
}
Expand Down Expand Up @@ -1249,6 +1262,7 @@ main(void)
/* Entry with '4' key should store value 'Buzz' */
struct hashmap_get_copy_output *get_copy_output =
FUTURE_OUTPUT(&get_futs[0]);
assert(strcmp(buf, val_4) == 0);
assert(get_copy_output->value == buf);
assert(get_copy_output->size == strlen(val_4) + 1);
/* 'hashmap_get_copy_fut' will not copy more data than buffer can fit */
Expand Down
2 changes: 1 addition & 1 deletion src/deps/miniasync/src/include/libminiasync/future.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ future_has_property_default(void *future, enum future_property property)
static inline int
future_chain_has_property(void *future, enum future_property property)
{
struct future *fut = future;
struct future *fut = (struct future *)future;
struct future_context *ctx = &fut->context;
uint8_t *data = (uint8_t *)future_context_get_data(ctx);
struct future_chain_entry *entry = (struct future_chain_entry *)(data);
Expand Down

0 comments on commit b1d7bb0

Please sign in to comment.