Skip to content

Commit

Permalink
Formatting switched PDC_calloc and PDC_free
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyunju Oh authored and Hyunju Oh committed Dec 28, 2023
1 parent 5489e4a commit edd0cd5
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/api/pdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ PDC_class__close(struct _pdc_class *p)
#endif

free(p->name);
p = (struct _pdc_class *)(intptr_t) PDC_free(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 = (struct pdc_id_list *)(intptr_t) PDC_free(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
10 changes: 5 additions & 5 deletions src/api/pdc_obj/pdc_cont.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ PDCcont_create_col(const char *cont_name, pdcid_t cont_prop_id)
id_info = PDC_find_id(cont_prop_id);
cont_prop = (struct _pdc_cont_prop *)(id_info->obj_ptr);

p->cont_pt =(struct _pdc_cont_prop *)PDC_calloc(1, sizeof(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));
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 = (struct pdc_cont_info *)(intptr_t) PDC_free(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 = (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);
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
38 changes: 19 additions & 19 deletions src/api/pdc_obj/pdc_obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,28 +417,28 @@ PDC_obj_close(struct _pdc_obj_info *op)

free((void *)(op->obj_info_pub->name));
free(op->cont->cont_info_pub->name);
op->cont->cont_info_pub = (struct pdc_cont_info *)(intptr_t) PDC_free(op->cont->cont_info_pub);
op->cont->cont_info_pub = (struct pdc_cont_info *)(intptr_t)PDC_free(op->cont->cont_info_pub);
free(op->cont->cont_pt->pdc->name);
op->cont->cont_pt->pdc = (struct _pdc_class *)(intptr_t) PDC_free(op->cont->cont_pt->pdc);
op->cont->cont_pt = (struct _pdc_cont_prop *)(intptr_t) PDC_free(op->cont->cont_pt);
op->cont = (struct _pdc_cont_info *)(intptr_t) PDC_free(op->cont);
op->cont->cont_pt->pdc = (struct _pdc_class *)(intptr_t)PDC_free(op->cont->cont_pt->pdc);
op->cont->cont_pt = (struct _pdc_cont_prop *)(intptr_t)PDC_free(op->cont->cont_pt);
op->cont = (struct _pdc_cont_info *)(intptr_t)PDC_free(op->cont);

free(op->obj_pt->pdc->name);
op->obj_pt->pdc = (struct _pdc_class *)(intptr_t) PDC_free(op->obj_pt->pdc);
op->obj_pt->pdc = (struct _pdc_class *)(intptr_t)PDC_free(op->obj_pt->pdc);
free(op->obj_pt->obj_prop_pub->dims);
op->obj_pt->obj_prop_pub = (struct pdc_obj_prop *)(intptr_t) PDC_free(op->obj_pt->obj_prop_pub);
op->obj_pt->obj_prop_pub = (struct pdc_obj_prop *)(intptr_t)PDC_free(op->obj_pt->obj_prop_pub);
free(op->obj_pt->app_name);
free(op->obj_pt->data_loc);
free(op->obj_pt->tags);
op->obj_pt = (struct _pdc_obj_prop *)(intptr_t) PDC_free(op->obj_pt);
op->obj_pt = (struct _pdc_obj_prop *)(intptr_t)PDC_free(op->obj_pt);
if (op->metadata != NULL)
free(op->metadata);

free(op->obj_info_pub->obj_pt->dims);
op->obj_info_pub->obj_pt = (struct pdc_obj_prop *)(intptr_t) PDC_free(op->obj_info_pub->obj_pt);
op->obj_info_pub = (struct pdc_obj_info *)(intptr_t) PDC_free(op->obj_info_pub);
op->obj_info_pub->obj_pt = (struct pdc_obj_prop *)(intptr_t)PDC_free(op->obj_info_pub->obj_pt);
op->obj_info_pub = (struct pdc_obj_info *)(intptr_t)PDC_free(op->obj_info_pub);

op = (struct _pdc_obj_info *)(intptr_t) PDC_free(op);
op = (struct _pdc_obj_info *)(intptr_t)PDC_free(op);

FUNC_LEAVE(ret_value);
}
Expand Down Expand Up @@ -1182,44 +1182,44 @@ PDC_free_obj_info(struct _pdc_obj_info *obj)

if (obj->obj_info_pub->name != NULL)
free(obj->obj_info_pub->name);
obj->obj_info_pub = (struct pdc_obj_info *)(intptr_t) PDC_free(obj->obj_info_pub);
obj->obj_info_pub = (struct pdc_obj_info *)(intptr_t)PDC_free(obj->obj_info_pub);

if (obj->metadata != NULL)
free(obj->metadata);

if (obj->cont != NULL) {
if (obj->cont->cont_info_pub->name != NULL)
free(obj->cont->cont_info_pub->name);
obj->cont->cont_info_pub = (struct pdc_cont_info *)(intptr_t) PDC_free(obj->cont->cont_info_pub);
obj->cont->cont_info_pub = (struct pdc_cont_info *)(intptr_t)PDC_free(obj->cont->cont_info_pub);
if (obj->cont->cont_pt->pdc->name != NULL)
free(obj->cont->cont_pt->pdc->name);
obj->cont->cont_pt->pdc = (struct _pdc_class *)(intptr_t) PDC_free(obj->cont->cont_pt->pdc);
obj->cont->cont_pt = (struct _pdc_cont_prop *)(intptr_t) PDC_free(obj->cont->cont_pt);
obj->cont = (struct _pdc_cont_info *)(intptr_t) PDC_free(obj->cont);
obj->cont->cont_pt->pdc = (struct _pdc_class *)(intptr_t)PDC_free(obj->cont->cont_pt->pdc);
obj->cont->cont_pt = (struct _pdc_cont_prop *)(intptr_t)PDC_free(obj->cont->cont_pt);
obj->cont = (struct _pdc_cont_info *)(intptr_t)PDC_free(obj->cont);
}

if (obj->obj_pt != NULL) {
if (obj->obj_pt->pdc != NULL) {
if (obj->obj_pt->pdc->name != NULL)
free(obj->obj_pt->pdc->name);
obj->obj_pt->pdc = (struct _pdc_class *)(intptr_t) PDC_free(obj->obj_pt->pdc);
obj->obj_pt->pdc = (struct _pdc_class *)(intptr_t)PDC_free(obj->obj_pt->pdc);
}
if (obj->obj_pt->obj_prop_pub->dims != NULL)
free(obj->obj_pt->obj_prop_pub->dims);
obj->obj_pt->obj_prop_pub = (struct pdc_obj_prop *)(intptr_t) PDC_free(obj->obj_pt->obj_prop_pub);
obj->obj_pt->obj_prop_pub = (struct pdc_obj_prop *)(intptr_t)PDC_free(obj->obj_pt->obj_prop_pub);
if (obj->obj_pt->app_name != NULL)
free(obj->obj_pt->app_name);
if (obj->obj_pt->data_loc != NULL)
free(obj->obj_pt->data_loc);
if (obj->obj_pt->tags != NULL)
free(obj->obj_pt->tags);
obj->obj_pt = (struct _pdc_obj_prop *)(intptr_t) PDC_free(obj->obj_pt);
obj->obj_pt = (struct _pdc_obj_prop *)(intptr_t)PDC_free(obj->obj_pt);
}

if (obj->region_list_head != NULL)
free(obj->region_list_head);

obj = (struct _pdc_obj_info *)(intptr_t) PDC_free(obj);
obj = (struct _pdc_obj_info *)(intptr_t)PDC_free(obj);

FUNC_LEAVE(ret_value);
}
Expand Down
8 changes: 4 additions & 4 deletions src/api/pdc_obj/pdc_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ pdc_prop_cont_close(struct _pdc_cont_prop *cp)
FUNC_ENTER(NULL);

free(cp->pdc->name);
cp->pdc = (struct _pdc_class *)(intptr_t) PDC_free(cp->pdc);
cp = (struct _pdc_cont_prop *)(intptr_t) PDC_free(cp);
cp->pdc = (struct _pdc_class *)(intptr_t)PDC_free(cp->pdc);
cp = (struct _pdc_cont_prop *)(intptr_t)PDC_free(cp);

FUNC_LEAVE(ret_value);
}
Expand All @@ -242,15 +242,15 @@ pdc_prop_obj_close(struct _pdc_obj_prop *cp)
FUNC_ENTER(NULL);

free(cp->pdc->name);
cp->pdc = (struct _pdc_class *)(intptr_t) PDC_free(cp->pdc);
cp->pdc = (struct _pdc_class *)(intptr_t)PDC_free(cp->pdc);
if (cp->obj_prop_pub->dims != NULL) {
free(cp->obj_prop_pub->dims);
cp->obj_prop_pub->dims = NULL;
}
free(cp->app_name);
free(cp->tags);
free(cp->data_loc);
cp = (struct _pdc_obj_prop *)(intptr_t) PDC_free(cp);
cp = (struct _pdc_obj_prop *)(intptr_t)PDC_free(cp);

FUNC_LEAVE(ret_value);
}
Expand Down
4 changes: 2 additions & 2 deletions src/api/pdc_region/pdc_region.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ pdc_region_close(struct pdc_region_info *op)
free(op->size);
free(op->offset);
if (op->obj != NULL)
op->obj = (struct _pdc_obj_info *)(intptr_t) PDC_free(op->obj);
op = (struct pdc_region_info *)(intptr_t) PDC_free(op);
op->obj = (struct _pdc_obj_info *)(intptr_t)PDC_free(op->obj);
op = (struct pdc_region_info *)(intptr_t)PDC_free(op);

FUNC_LEAVE(ret_value);
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/pdc_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ PDC_dec_ref(pdcid_t id)
PDC_MUTEX_LOCK(type_ptr->ids);
/* Remove the node from the type */
PDC_LIST_REMOVE(id_ptr, entry);
id_ptr = (struct _pdc_id_info *)(intptr_t) PDC_free(id_ptr);
id_ptr = (struct _pdc_id_info *)(intptr_t)PDC_free(id_ptr);
/* Decrement the number of IDs in the type */
(type_ptr->id_count)--;
ret_value = 0;
Expand Down Expand Up @@ -267,7 +267,7 @@ PDC_id_list_clear(PDC_type_t type)
if (!type_ptr->free_func || (type_ptr->free_func)((void *)id_ptr->obj_ptr) >= 0) {
PDC_MUTEX_LOCK(type_ptr->ids);
PDC_LIST_REMOVE(id_ptr, entry);
id_ptr = (struct _pdc_id_info *)(intptr_t) PDC_free(id_ptr);
id_ptr = (struct _pdc_id_info *)(intptr_t)PDC_free(id_ptr);
(type_ptr->id_count)--;
PDC_MUTEX_UNLOCK(type_ptr->ids);
}
Expand All @@ -289,7 +289,7 @@ PDC_destroy_type(PDC_type_t type)
type_ptr = (pdc_id_list_g->PDC_id_type_list_g)[type];
if (type_ptr == NULL)
PGOTO_ERROR(FAIL, "type was not initialized correctly");
type_ptr = (struct PDC_id_type *)(intptr_t) PDC_free(type_ptr);
type_ptr = (struct PDC_id_type *)(intptr_t)PDC_free(type_ptr);

done:
fflush(stdout);
Expand Down

0 comments on commit edd0cd5

Please sign in to comment.