Commit 95bdea25 authored by Jonathan Jenkins's avatar Jonathan Jenkins

add convenience NULL define for margo id

parent cfd6bf7e
...@@ -21,6 +21,8 @@ extern "C" { ...@@ -21,6 +21,8 @@ extern "C" {
struct margo_instance; struct margo_instance;
typedef struct margo_instance* margo_instance_id; typedef struct margo_instance* margo_instance_id;
#define MARGO_INSTANCE_NULL ((margo_instance_id)NULL)
/** /**
* Initializes margo library from given argobots and Mercury instances. * Initializes margo library from given argobots and Mercury instances.
* @param [in] progress_pool Argobots pool to drive communication * @param [in] progress_pool Argobots pool to drive communication
......
...@@ -54,11 +54,11 @@ margo_instance_id margo_init(ABT_pool progress_pool, ABT_pool handler_pool, ...@@ -54,11 +54,11 @@ margo_instance_id margo_init(ABT_pool progress_pool, ABT_pool handler_pool,
struct margo_instance *mid; struct margo_instance *mid;
if(handler_mapping_table_size >= MAX_HANDLER_MAPPING) if(handler_mapping_table_size >= MAX_HANDLER_MAPPING)
return(NULL); return(MARGO_INSTANCE_NULL);
mid = malloc(sizeof(*mid)); mid = malloc(sizeof(*mid));
if(!mid) if(!mid)
return(NULL); return(MARGO_INSTANCE_NULL);
memset(mid, 0, sizeof(*mid)); memset(mid, 0, sizeof(*mid));
mid->progress_pool = progress_pool; mid->progress_pool = progress_pool;
...@@ -72,7 +72,7 @@ margo_instance_id margo_init(ABT_pool progress_pool, ABT_pool handler_pool, ...@@ -72,7 +72,7 @@ margo_instance_id margo_init(ABT_pool progress_pool, ABT_pool handler_pool,
{ {
fprintf(stderr, "Error: ABT_thread_create()\n"); fprintf(stderr, "Error: ABT_thread_create()\n");
free(mid); free(mid);
return(NULL); return(MARGO_INSTANCE_NULL);
} }
handler_mapping_table[handler_mapping_table_size].mid = mid; handler_mapping_table[handler_mapping_table_size].mid = mid;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment