Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing PDC macro #189

Merged
merged 10 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/api/pdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ PDC_class_create(const char *pdc_name)

FUNC_ENTER(NULL);

p = PDC_MALLOC(struct _pdc_class);
p = (struct _pdc_class *)PDC_malloc(sizeof(struct _pdc_class));
if (!p)
PGOTO_ERROR(FAIL, "PDC class property memory allocation failed\n");

Expand All @@ -89,7 +89,7 @@ PDCinit(const char *pdc_name)

FUNC_ENTER(NULL);

if (NULL == (pdc_id_list_g = PDC_CALLOC(1, struct pdc_id_list)))
if (NULL == (pdc_id_list_g = (struct pdc_id_list *)PDC_calloc(1, sizeof(struct pdc_id_list))))
PGOTO_ERROR(FAIL, "PDC global id list: memory allocation failed");

if (PDC_class_init() < 0)
Expand Down Expand Up @@ -130,7 +130,7 @@ PDC_class__close(struct _pdc_class *p)
#endif

free(p->name);
p = PDC_FREE(struct _pdc_class, p);
p = (struct _pdc_class *)(intptr_t)PDC_free(p);

FUNC_LEAVE(ret_value);
}
Expand Down Expand Up @@ -214,7 +214,7 @@ PDCclose(pdcid_t pdcid)

PDC_class_end();

pdc_id_list_g = PDC_FREE(struct pdc_id_list, pdc_id_list_g);
pdc_id_list_g = (struct pdc_id_list *)(intptr_t)PDC_free(pdc_id_list_g);

// Finalize METADATA
PDC_Client_finalize();
Expand Down
3 changes: 2 additions & 1 deletion src/api/pdc_analysis/pdc_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ PDCobj_analysis_register(char *func, pdcid_t iterIn, pdcid_t iterOut)
if ((ftnPtr = ftnHandle) == NULL)
PGOTO_ERROR(FAIL, "Analysis function lookup failed");

if ((thisFtn = PDC_MALLOC(struct _pdc_region_analysis_ftn_info)) == NULL)
if ((thisFtn = (struct _pdc_region_analysis_ftn_info *)PDC_malloc(
sizeof(struct _pdc_region_analysis_ftn_info))) == NULL)
PGOTO_ERROR(FAIL, "PDC register_obj_analysis memory allocation failed");

thisFtn->ftnPtr = (int (*)())ftnPtr;
Expand Down
44 changes: 22 additions & 22 deletions src/api/pdc_obj/pdc_cont.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,24 @@ PDCcont_create(const char *cont_name, pdcid_t cont_prop_id)

FUNC_ENTER(NULL);

p = PDC_MALLOC(struct _pdc_cont_info);
p = (struct _pdc_cont_info *)PDC_malloc(sizeof(struct _pdc_cont_info));
if (!p)
PGOTO_ERROR(0, "PDC container memory allocation failed");

p->cont_info_pub = PDC_MALLOC(struct pdc_cont_info);
p->cont_info_pub = (struct pdc_cont_info *)PDC_malloc(sizeof(struct pdc_cont_info));
if (!p->cont_info_pub)
PGOTO_ERROR(0, "PDC pub container memory allocation failed");
p->cont_info_pub->name = strdup(cont_name);

id_info = PDC_find_id(cont_prop_id);
cont_prop = (struct _pdc_cont_prop *)(id_info->obj_ptr);

p->cont_pt = PDC_CALLOC(1, struct _pdc_cont_prop);
p->cont_pt = (struct _pdc_cont_prop *)PDC_calloc(1, sizeof(struct _pdc_cont_prop));
if (!p->cont_pt)
PGOTO_ERROR(0, "PDC container prop memory allocation failed");
memcpy(p->cont_pt, cont_prop, sizeof(struct _pdc_cont_prop));

p->cont_pt->pdc = PDC_CALLOC(1, struct _pdc_class);
p->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class));
if (!p->cont_pt->pdc)
PGOTO_ERROR(0, "PDC container pdc class memory allocation failed");
if (cont_prop->pdc->name)
Expand Down Expand Up @@ -110,24 +110,24 @@ PDCcont_create_col(const char *cont_name, pdcid_t cont_prop_id)

FUNC_ENTER(NULL);

p = PDC_MALLOC(struct _pdc_cont_info);
p = (struct _pdc_cont_info *)PDC_malloc(sizeof(struct _pdc_cont_info));
if (!p)
PGOTO_ERROR(0, "PDC container memory allocation failed");

p->cont_info_pub = PDC_MALLOC(struct pdc_cont_info);
p->cont_info_pub = (struct pdc_cont_info *)PDC_malloc(sizeof(struct pdc_cont_info));
if (!p->cont_info_pub)
PGOTO_ERROR(0, "PDC pub container memory allocation failed");
p->cont_info_pub->name = strdup(cont_name);

id_info = PDC_find_id(cont_prop_id);
cont_prop = (struct _pdc_cont_prop *)(id_info->obj_ptr);

p->cont_pt = PDC_CALLOC(1, struct _pdc_cont_prop);
p->cont_pt = (struct _pdc_cont_prop *)PDC_calloc(1, sizeof(struct _pdc_cont_prop));
if (!p->cont_pt)
PGOTO_ERROR(0, "PDC container prop memory allocation failed");
memcpy(p->cont_pt, cont_prop, sizeof(struct _pdc_cont_prop));

p->cont_pt->pdc = PDC_CALLOC(1, struct _pdc_class);
p->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class));
if (!p->cont_pt->pdc)
PGOTO_ERROR(0, "PDC container pdc class memory allocation failed");
if (cont_prop->pdc->name)
Expand Down Expand Up @@ -157,11 +157,11 @@ PDC_cont_create_local(pdcid_t pdc, const char *cont_name, uint64_t cont_meta_id)

FUNC_ENTER(NULL);

p = PDC_MALLOC(struct _pdc_cont_info);
p = (struct _pdc_cont_info *)PDC_malloc(sizeof(struct _pdc_cont_info));
if (!p)
PGOTO_ERROR(0, "PDC container memory allocation failed");

p->cont_info_pub = PDC_MALLOC(struct pdc_cont_info);
p->cont_info_pub = (struct pdc_cont_info *)PDC_malloc(sizeof(struct pdc_cont_info));
if (!p)
PGOTO_ERROR(0, "PDC container memory allocation failed");
p->cont_info_pub->name = strdup(cont_name);
Expand All @@ -171,12 +171,12 @@ PDC_cont_create_local(pdcid_t pdc, const char *cont_name, uint64_t cont_meta_id)

id_info = PDC_find_id(cont_prop_id);
cont_prop = (struct _pdc_cont_prop *)(id_info->obj_ptr);
p->cont_pt = PDC_CALLOC(1, struct _pdc_cont_prop);
p->cont_pt = (struct _pdc_cont_prop *)PDC_calloc(1, sizeof(struct _pdc_cont_prop));
if (!p->cont_pt)
PGOTO_ERROR(0, "PDC container prop memory allocation failed");
memcpy(p->cont_pt, cont_prop, sizeof(struct _pdc_cont_prop));

p->cont_pt->pdc = PDC_CALLOC(1, struct _pdc_class);
p->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class));
if (!p->cont_pt->pdc)
PGOTO_ERROR(0, "PDC container pdc class memory allocation failed");

Expand Down Expand Up @@ -222,11 +222,11 @@ PDC_cont_close(struct _pdc_cont_info *cp)
FUNC_ENTER(NULL);

free((void *)(cp->cont_info_pub->name));
cp->cont_info_pub = PDC_FREE(struct pdc_cont_info, cp->cont_info_pub);
cp->cont_info_pub = (struct pdc_cont_info *)(intptr_t)PDC_free(cp->cont_info_pub);
free(cp->cont_pt->pdc->name);
cp->cont_pt->pdc = PDC_FREE(struct _pdc_class, cp->cont_pt->pdc);
cp->cont_pt = PDC_FREE(struct _pdc_cont_prop, cp->cont_pt);
cp = PDC_FREE(struct _pdc_cont_info, cp);
cp->cont_pt->pdc = (struct _pdc_class *)(intptr_t)PDC_free(cp->cont_pt->pdc);
cp->cont_pt = (struct _pdc_cont_prop *)(intptr_t)PDC_free(cp->cont_pt);
cp = (struct _pdc_cont_info *)(intptr_t)PDC_free(cp);

FUNC_LEAVE(ret_value);
}
Expand Down Expand Up @@ -321,25 +321,25 @@ PDC_cont_get_info(pdcid_t cont_id)
PGOTO_ERROR(NULL, "cannot locate object");

info = (struct _pdc_cont_info *)(id_info->obj_ptr);
ret_value = PDC_CALLOC(1, struct _pdc_cont_info);
ret_value = (struct _pdc_cont_info *)PDC_calloc(1, sizeof(struct _pdc_cont_info));
if (ret_value)
memcpy(ret_value, info, sizeof(struct _pdc_cont_info));
else
PGOTO_ERROR(NULL, "cannot allocate ret_value");

ret_value->cont_info_pub = PDC_CALLOC(1, struct pdc_cont_info);
ret_value->cont_info_pub = (struct pdc_cont_info *)PDC_calloc(1, sizeof(struct pdc_cont_info));
if (ret_value->cont_info_pub)
memcpy(ret_value->cont_info_pub, info->cont_info_pub, sizeof(struct pdc_cont_info));

if (info->cont_info_pub->name)
ret_value->cont_info_pub->name = strdup(info->cont_info_pub->name);

ret_value->cont_pt = PDC_MALLOC(struct _pdc_cont_prop);
ret_value->cont_pt = (struct _pdc_cont_prop *)PDC_malloc(sizeof(struct _pdc_cont_prop));
if (ret_value->cont_pt)
memcpy(ret_value->cont_pt, info->cont_pt, sizeof(struct _pdc_cont_prop));
else
PGOTO_ERROR(NULL, "cannot allocate ret_value->cont_pt");
ret_value->cont_pt->pdc = PDC_CALLOC(1, struct _pdc_class);
ret_value->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class));
if (ret_value->cont_pt->pdc) {
ret_value->cont_pt->pdc->local_id = info->cont_pt->pdc->local_id;
if (info->cont_pt->pdc->name)
Expand All @@ -366,7 +366,7 @@ PDCcont_get_info(const char *cont_name)

tmp = PDC_cont_get_info(cont_id);

ret_value = PDC_CALLOC(1, struct pdc_cont_info);
ret_value = (struct pdc_cont_info *)PDC_calloc(1, sizeof(struct pdc_cont_info));
if (!ret_value)
PGOTO_ERROR(NULL, "cannot allocate memory");

Expand Down Expand Up @@ -440,7 +440,7 @@ PDCcont_iter_get_info(cont_handle *chandle)
if (info == NULL)
PGOTO_ERROR(NULL, "PDC container info memory allocation failed");

ret_value = PDC_CALLOC(1, struct pdc_cont_info);
ret_value = (struct pdc_cont_info *)PDC_calloc(1, sizeof(struct pdc_cont_info));
if (!ret_value)
PGOTO_ERROR(NULL, "failed to allocate memory");

Expand Down
Loading
Loading