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