Skip to content

Commit

Permalink
change not to free constants
Browse files Browse the repository at this point in the history
  • Loading branch information
seiya committed Jul 17, 2013
1 parent 08650ac commit aeb8f2d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ext/mpi/mpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,21 @@ name ## _free(void *ptr)\
check_error(MPI_ ## name ## _free(&(obj->name))); \
free(obj);\
}
#define DEF_FREE2(name, capit) \
static void \
name ## _free2(void *ptr)\
{\
struct _ ## name *obj;\
obj = (struct _ ## name*) ptr;\
free(obj);\
}
DEF_FREE(Comm, COMM)
DEF_FREE(Request, REQUEST)
DEF_FREE(Op, OP)
DEF_FREE(Errhandler, ERRHANDLER)
DEF_FREE2(Comm, COMM)
DEF_FREE2(Op, OP)
DEF_FREE2(Errhandler, ERRHANDLER)
static void
Status_free(void *ptr)
{
Expand All @@ -179,7 +190,7 @@ Status_free(void *ptr)
v = ALLOC(struct _ ## v);\
v->v = const;\
v->free = false;\
rb_define_const(c ## v, #name, Data_Wrap_Struct(c ## v, NULL, v ## _free, v)); \
rb_define_const(c ## v, #name, Data_Wrap_Struct(c ## v, NULL, v ## _free2, v)); \
}

static void
Expand Down

0 comments on commit aeb8f2d

Please sign in to comment.