Skip to content

Commit dd3628f

Browse files
author
Hyunju Oh
committed
Remove PDC_MALLOC macro
1 parent 4ef9fd4 commit dd3628f

File tree

10 files changed

+25
-25
lines changed

10 files changed

+25
-25
lines changed

src/api/pdc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ PDC_class_create(const char *pdc_name)
6767

6868
FUNC_ENTER(NULL);
6969

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

src/api/pdc_analysis/pdc_analysis.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ PDCobj_analysis_register(char *func, pdcid_t iterIn, pdcid_t iterOut)
453453
if ((ftnPtr = ftnHandle) == NULL)
454454
PGOTO_ERROR(FAIL, "Analysis function lookup failed");
455455

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

459459
thisFtn->ftnPtr = (int (*)())ftnPtr;

src/api/pdc_obj/pdc_cont.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ PDCcont_create(const char *cont_name, pdcid_t cont_prop_id)
6161

6262
FUNC_ENTER(NULL);
6363

64-
p = PDC_MALLOC(struct _pdc_cont_info);
64+
p = (struct _pdc_cont_info *)PDC_malloc(sizeof(struct _pdc_cont_info));
6565
if (!p)
6666
PGOTO_ERROR(0, "PDC container memory allocation failed");
6767

68-
p->cont_info_pub = PDC_MALLOC(struct pdc_cont_info);
68+
p->cont_info_pub = (struct pdc_cont_info *)PDC_malloc(sizeof(struct pdc_cont_info));
6969
if (!p->cont_info_pub)
7070
PGOTO_ERROR(0, "PDC pub container memory allocation failed");
7171
p->cont_info_pub->name = strdup(cont_name);
@@ -109,11 +109,11 @@ PDCcont_create_col(const char *cont_name, pdcid_t cont_prop_id)
109109

110110
FUNC_ENTER(NULL);
111111

112-
p = PDC_MALLOC(struct _pdc_cont_info);
112+
p = (struct _pdc_cont_info *)PDC_malloc(sizeof(struct _pdc_cont_info));
113113
if (!p)
114114
PGOTO_ERROR(0, "PDC container memory allocation failed");
115115

116-
p->cont_info_pub = PDC_MALLOC(struct pdc_cont_info);
116+
p->cont_info_pub = (struct pdc_cont_info *)PDC_malloc(sizeof(struct pdc_cont_info));
117117
if (!p->cont_info_pub)
118118
PGOTO_ERROR(0, "PDC pub container memory allocation failed");
119119
p->cont_info_pub->name = strdup(cont_name);
@@ -156,11 +156,11 @@ PDC_cont_create_local(pdcid_t pdc, const char *cont_name, uint64_t cont_meta_id)
156156

157157
FUNC_ENTER(NULL);
158158

159-
p = PDC_MALLOC(struct _pdc_cont_info);
159+
p = (struct _pdc_cont_info *)PDC_malloc(sizeof(struct _pdc_cont_info));
160160
if (!p)
161161
PGOTO_ERROR(0, "PDC container memory allocation failed");
162162

163-
p->cont_info_pub = PDC_MALLOC(struct pdc_cont_info);
163+
p->cont_info_pub = (struct pdc_cont_info *)PDC_malloc(sizeof(struct pdc_cont_info));
164164
if (!p)
165165
PGOTO_ERROR(0, "PDC container memory allocation failed");
166166
p->cont_info_pub->name = strdup(cont_name);
@@ -332,7 +332,7 @@ PDC_cont_get_info(pdcid_t cont_id)
332332
if (info->cont_info_pub->name)
333333
ret_value->cont_info_pub->name = strdup(info->cont_info_pub->name);
334334

335-
ret_value->cont_pt = PDC_MALLOC(struct _pdc_cont_prop);
335+
ret_value->cont_pt = (struct _pdc_cont_prop *)PDC_malloc(sizeof(struct _pdc_cont_prop));
336336
if (ret_value->cont_pt)
337337
memcpy(ret_value->cont_pt, info->cont_pt, sizeof(struct _pdc_cont_prop));
338338
else

src/api/pdc_obj/pdc_obj.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ PDCobj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id)
7272
pdcid_t ret_value = 0;
7373
FUNC_ENTER(NULL);
7474
#if 0
75-
p = PDC_MALLOC(struct _pdc_obj_info);
75+
p = (struct _pdc_obj_info *)PDC_malloc(sizeof(struct _pdc_obj_info));
7676
if (!p)
7777
PGOTO_ERROR(0, "PDC object memory allocation failed");
7878
p->metadata = NULL;
@@ -146,7 +146,7 @@ PDCobj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id)
146146
if (obj_prop->tags)
147147
p->obj_pt->tags = strdup(obj_prop->tags);
148148

149-
p->obj_info_pub = PDC_MALLOC(struct pdc_obj_info);
149+
p->obj_info_pub = (struct pdc_obj_info *)PDC_malloc(sizeof(struct pdc_obj_info));
150150
if (!p->obj_info_pub)
151151
PGOTO_ERROR(0, "PDC pub object memory allocation failed");
152152
p->obj_info_pub->name = strdup(obj_name);
@@ -239,7 +239,7 @@ PDC_obj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id, _pdc_
239239

240240
FUNC_ENTER(NULL);
241241

242-
p = PDC_MALLOC(struct _pdc_obj_info);
242+
p = (struct _pdc_obj_info *)PDC_malloc(sizeof(struct _pdc_obj_info));
243243
if (!p)
244244
PGOTO_ERROR(0, "PDC object memory allocation failed");
245245
p->metadata = NULL;
@@ -329,7 +329,7 @@ PDC_obj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id, _pdc_
329329
p->local_transfer_request_end = NULL;
330330
p->local_transfer_request_size = 0;
331331
/* struct pdc_obj_info field */
332-
p->obj_info_pub = PDC_MALLOC(struct pdc_obj_info);
332+
p->obj_info_pub = (struct pdc_obj_info *)PDC_malloc(sizeof(struct pdc_obj_info));
333333
if (!p->obj_info_pub)
334334
PGOTO_ERROR(0, "PDC pub object memory allocation failed");
335335
p->obj_info_pub->name = strdup(obj_name);
@@ -537,7 +537,7 @@ PDCobj_open_common(const char *obj_name, pdcid_t pdc, int is_col)
537537

538538
FUNC_ENTER(NULL);
539539

540-
p = PDC_MALLOC(struct _pdc_obj_info);
540+
p = (struct _pdc_obj_info *)PDC_malloc(sizeof(struct _pdc_obj_info));
541541
if (!p)
542542
PGOTO_ERROR(0, "PDC object memory allocation failed");
543543
p->cont = PDC_CALLOC(1, struct _pdc_cont_info);
@@ -558,7 +558,7 @@ PDCobj_open_common(const char *obj_name, pdcid_t pdc, int is_col)
558558
p->obj_pt->obj_prop_pub = PDC_CALLOC(1, struct pdc_obj_prop);
559559
if (!p->obj_pt->obj_prop_pub)
560560
PGOTO_ERROR(0, "PDC object property memory allocation failed");
561-
p->obj_info_pub = PDC_MALLOC(struct pdc_obj_info);
561+
p->obj_info_pub = (struct pdc_obj_info *)PDC_malloc(sizeof(struct pdc_obj_info));
562562
if (!p->obj_info_pub)
563563
PGOTO_ERROR(0, "PDC pub object memory allocation failed");
564564
p->obj_info_pub->obj_pt = PDC_CALLOC(1, struct pdc_obj_prop);

src/api/pdc_obj/pdc_prop.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ PDCprop_create(pdc_prop_type_t type, pdcid_t pdcid)
6767
FUNC_ENTER(NULL);
6868

6969
if (type == PDC_CONT_CREATE) {
70-
p = PDC_MALLOC(struct _pdc_cont_prop);
70+
p = (struct _pdc_cont_prop *)PDC_malloc(sizeof(struct _pdc_cont_prop));
7171
if (!p)
7272
PGOTO_ERROR(0, "PDC container property memory allocation failed");
7373
p->cont_life = PDC_PERSIST;
@@ -85,10 +85,10 @@ PDCprop_create(pdc_prop_type_t type, pdcid_t pdcid)
8585
ret_value = new_id_c;
8686
}
8787
if (type == PDC_OBJ_CREATE) {
88-
q = PDC_MALLOC(struct _pdc_obj_prop);
88+
q = (struct _pdc_obj_prop *)PDC_malloc(sizeof(struct _pdc_obj_prop));
8989
if (!q)
9090
PGOTO_ERROR(0, "PDC object property memory allocation failed");
91-
q->obj_prop_pub = PDC_MALLOC(struct pdc_obj_prop);
91+
q->obj_prop_pub = (struct pdc_obj_prop *)PDC_malloc(sizeof(struct pdc_obj_prop));
9292
if (!q->obj_prop_pub)
9393
PGOTO_ERROR(0, "PDC object pub property memory allocation failed");
9494
q->obj_prop_pub->ndim = 0;
@@ -153,7 +153,7 @@ PDCprop_obj_dup(pdcid_t prop_id)
153153
q->buf = NULL;
154154

155155
/* struct obj_prop_pub field */
156-
q->obj_prop_pub = PDC_MALLOC(struct pdc_obj_prop);
156+
q->obj_prop_pub = (struct pdc_obj_prop *)PDC_malloc(sizeof(struct pdc_obj_prop));
157157
if (!q->obj_prop_pub)
158158
PGOTO_ERROR(0, "PDC object property memory allocation failed");
159159
new_id = PDC_id_register(PDC_OBJ_PROP, q);

src/api/pdc_region/pdc_region.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ PDCregion_create(psize_t ndims, uint64_t *offset, uint64_t *size)
184184

185185
FUNC_ENTER(NULL);
186186

187-
p = PDC_MALLOC(struct pdc_region_info);
187+
p = (struct pdc_region_info *)PDC_malloc(sizeof(struct pdc_region_info));
188188
if (!p)
189189
PGOTO_ERROR(ret_value, "PDC region memory allocation failed");
190190
p->ndim = ndims;

src/api/pdc_region/pdc_region_transfer.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ PDCregion_transfer_create(void *buf, pdc_access_t access_type, pdcid_t obj_id, p
208208
obj2 = (struct _pdc_obj_info *)(objinfo2->obj_ptr);
209209
// remote_meta_id = obj2->obj_info_pub->meta_id;
210210

211-
p = PDC_MALLOC(pdc_transfer_request);
211+
p = (pdc_transfer_request *)PDC_malloc(sizeof(pdc_transfer_request));
212212
p->obj_pointer = obj2;
213213
p->mem_type = obj2->obj_pt->obj_prop_pub->type;
214214
p->obj_id = obj2->obj_info_pub->meta_id;

src/api/pdc_transform/pdc_transform.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ PDCobj_transform_register(char *func, pdcid_t obj_id, int current_state, int nex
9393
if ((ftnPtr = ftnHandle) == NULL)
9494
PGOTO_ERROR(FAIL, "Transforms function lookup failed");
9595

96-
if ((thisFtn = PDC_MALLOC(struct _pdc_region_transform_ftn_info)) == NULL)
96+
if ((thisFtn = (struct _pdc_region_transform_ftn_info *)PDC_malloc(sizeof(struct _pdc_region_transform_ftn_info))) == NULL)
9797
PGOTO_ERROR(FAIL, "PDC register_obj_transforms memory allocation failed");
9898

9999
memset(thisFtn, 0, sizeof(struct _pdc_region_transform_ftn_info));
@@ -206,7 +206,7 @@ PDCbuf_map_transform_register(char *func, void *buf, pdcid_t src_region_id, pdci
206206
if ((ftnPtr = ftnHandle) == NULL)
207207
PGOTO_ERROR(FAIL, "Transforms function lookup failed\n");
208208

209-
if ((thisFtn = PDC_MALLOC(struct _pdc_region_transform_ftn_info)) == NULL)
209+
if ((thisFtn = (struct _pdc_region_transform_ftn_info *)PDC_malloc(sizeof(struct _pdc_region_transform_ftn_info))) == NULL)
210210
PGOTO_ERROR(FAIL, "PDC register_obj_transforms memory allocation failed");
211211

212212
thisFtn->ftnPtr = (size_t(*)())ftnPtr;

src/commons/utils/include/pdc_malloc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void *PDC_free(void *mem);
7676
*/
7777
size_t PDC_get_global_mem_usage();
7878

79-
#define PDC_MALLOC(t) (t *)PDC_malloc(sizeof(t))
79+
//#define PDC_MALLOC(t) (t *)PDC_malloc(sizeof(t))
8080
#define PDC_CALLOC(c, t) (t *)PDC_calloc(c, sizeof(t))
8181

8282
#define PDC_FREE(t, obj) (t *)(intptr_t) PDC_free(obj)

src/utils/pdc_interface.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ PDC_id_register(PDC_type_t type, void *object)
120120
type_ptr = (pdc_id_list_g->PDC_id_type_list_g)[type];
121121
if (NULL == type_ptr || type_ptr->init_count <= 0)
122122
PGOTO_ERROR(ret_value, "invalid type");
123-
if (NULL == (id_ptr = PDC_MALLOC(struct _pdc_id_info)))
123+
if (NULL == (id_ptr = (struct _pdc_id_info *)PDC_malloc(sizeof(struct _pdc_id_info))))
124124
PGOTO_ERROR(ret_value, "memory allocation failed");
125125

126126
/* Create the struct & it's ID */

0 commit comments

Comments
 (0)