mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 10:15:57 +01:00
pure_cpp: prepare for object move
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
CFLGS = -std=c99
|
||||
CCFLGS = -ggdb3 -O0 -pedantic-errors -Wall -Wextra
|
||||
CCFLGS = -ggdb3 -O0 -pedantic-errors -Wall -Wextra -Wno-missing-field-initializers
|
||||
CXXFLGS = -std=c++11
|
||||
IN_EXT = .c
|
||||
IN_CXX_EXT = .cpp
|
||||
|
||||
@@ -77,6 +77,7 @@ struct MyDerivedNativeClass : public MyNativeClass {
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
MyNativeClass *cpp_object;
|
||||
PyObject *first;
|
||||
PyObject *last;
|
||||
int number;
|
||||
@@ -106,12 +107,9 @@ my_native_module_MyNativeClass_clear(my_native_module_MyNativeClass *self)
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
my_native_module_MyNativeClass_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
my_native_module_MyNativeClass_new_noalloc (my_native_module_MyNativeClass *self, PyObject *args, PyObject *kwds) {
|
||||
(void)args;
|
||||
(void)kwds;
|
||||
my_native_module_MyNativeClass *self;
|
||||
self = (my_native_module_MyNativeClass *) type->tp_alloc(type, 0);
|
||||
if (self != NULL) {
|
||||
self->first = PyUnicode_FromString("");
|
||||
if (self->first == NULL) {
|
||||
@@ -128,6 +126,14 @@ my_native_module_MyNativeClass_new(PyTypeObject *type, PyObject *args, PyObject
|
||||
return (PyObject *) self;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
my_native_module_MyNativeClass_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
my_native_module_MyNativeClass *self;
|
||||
self = (my_native_module_MyNativeClass *) type->tp_alloc(type, 0);
|
||||
return (PyObject *) my_native_module_MyNativeClass_new_noalloc(self, args, kwds);
|
||||
}
|
||||
|
||||
static int
|
||||
my_native_module_MyNativeClass_init(my_native_module_MyNativeClass *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
@@ -289,6 +295,7 @@ my_native_module_MyDerivedNativeClass_new(PyTypeObject *type, PyObject *args, Py
|
||||
(void)kwds;
|
||||
my_native_module_MyDerivedNativeClass *self;
|
||||
self = (my_native_module_MyDerivedNativeClass *) type->tp_alloc(type, 0);
|
||||
my_native_module_MyNativeClass_new_noalloc((my_native_module_MyNativeClass *) self, args, kwds);
|
||||
if (self != NULL) {
|
||||
self->first2 = PyUnicode_FromString("");
|
||||
if (self->first2 == NULL) {
|
||||
|
||||
Reference in New Issue
Block a user