提交 ba179eea authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Make _executor() and _destructor() static.

上级 34737cd2
...@@ -1287,22 +1287,22 @@ class CLinker(link.Linker): ...@@ -1287,22 +1287,22 @@ class CLinker(link.Linker):
# instantiate. # instantiate.
if PY3: if PY3:
static = """ static = """
int {struct_name}_executor({struct_name} *self) {{ static int {struct_name}_executor({struct_name} *self) {{
return self->run(); return self->run();
}} }}
void {struct_name}_destructor(PyObject *capsule) {{ static void {struct_name}_destructor(PyObject *capsule) {{
{struct_name} *self = ({struct_name} *)PyCapsule_GetContext(capsule); {struct_name} *self = ({struct_name} *)PyCapsule_GetContext(capsule);
delete self; delete self;
}} }}
""".format(struct_name=self.struct_name) """.format(struct_name=self.struct_name)
else: else:
static = """ static = """
int %(struct_name)s_executor(%(struct_name)s* self) { static int %(struct_name)s_executor(%(struct_name)s* self) {
return self->run(); return self->run();
} }
void %(struct_name)s_destructor(void* executor, void* self) { static void %(struct_name)s_destructor(void* executor, void* self) {
delete ((%(struct_name)s*)self); delete ((%(struct_name)s*)self);
} }
""" % dict(struct_name=self.struct_name) """ % dict(struct_name=self.struct_name)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论