Eliminate unnecessary initialization code.
This commit is contained in:
parent
d57a33d544
commit
4e1c26a3dc
@ -814,7 +814,6 @@ static PyObject* Connection_New(
|
|||||||
if (!self)
|
if (!self)
|
||||||
return NULL;
|
return NULL;
|
||||||
self->commitMode = OCI_DEFAULT;
|
self->commitMode = OCI_DEFAULT;
|
||||||
self->environment = NULL;
|
|
||||||
|
|
||||||
return (PyObject*) self;
|
return (PyObject*) self;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,11 +72,8 @@ static udt_Environment *Environment_New(
|
|||||||
env = (udt_Environment*) g_EnvironmentType.tp_alloc(&g_EnvironmentType, 0);
|
env = (udt_Environment*) g_EnvironmentType.tp_alloc(&g_EnvironmentType, 0);
|
||||||
if (!env)
|
if (!env)
|
||||||
return NULL;
|
return NULL;
|
||||||
env->handle = NULL;
|
|
||||||
env->errorHandle = NULL;
|
|
||||||
env->fixedWidth = 1;
|
env->fixedWidth = 1;
|
||||||
env->maxBytesPerCharacter = 1;
|
env->maxBytesPerCharacter = 1;
|
||||||
env->cloneEnv = NULL;
|
|
||||||
cxBuffer_Init(&env->numberToStringFormatBuffer);
|
cxBuffer_Init(&env->numberToStringFormatBuffer);
|
||||||
cxBuffer_Init(&env->numberFromStringFormatBuffer);
|
cxBuffer_Init(&env->numberFromStringFormatBuffer);
|
||||||
cxBuffer_Init(&env->nlsNumericCharactersBuffer);
|
cxBuffer_Init(&env->nlsNumericCharactersBuffer);
|
||||||
|
|||||||
@ -363,13 +363,6 @@ static udt_ObjectType *ObjectType_New(
|
|||||||
return NULL;
|
return NULL;
|
||||||
Py_INCREF(connection->environment);
|
Py_INCREF(connection->environment);
|
||||||
self->environment = connection->environment;
|
self->environment = connection->environment;
|
||||||
self->tdo = NULL;
|
|
||||||
self->schema = NULL;
|
|
||||||
self->name = NULL;
|
|
||||||
self->attributes = NULL;
|
|
||||||
self->attributesByName = NULL;
|
|
||||||
self->elementType = NULL;
|
|
||||||
self->isCollection = 0;
|
|
||||||
if (ObjectType_Initialize(self, connection, param, nameAttribute) < 0) {
|
if (ObjectType_Initialize(self, connection, param, nameAttribute) < 0) {
|
||||||
Py_DECREF(self);
|
Py_DECREF(self);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -553,8 +546,6 @@ static udt_ObjectAttribute *ObjectAttribute_New(
|
|||||||
g_ObjectAttributeType.tp_alloc(&g_ObjectAttributeType, 0);
|
g_ObjectAttributeType.tp_alloc(&g_ObjectAttributeType, 0);
|
||||||
if (!self)
|
if (!self)
|
||||||
return NULL;
|
return NULL;
|
||||||
self->name = NULL;
|
|
||||||
self->subType = NULL;
|
|
||||||
if (ObjectAttribute_Initialize(self, connection, param) < 0) {
|
if (ObjectAttribute_Initialize(self, connection, param) < 0) {
|
||||||
Py_DECREF(self);
|
Py_DECREF(self);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@ -160,7 +160,6 @@ static PyObject *SessionPool_New(
|
|||||||
newObject = (udt_SessionPool*) type->tp_alloc(type, 0);
|
newObject = (udt_SessionPool*) type->tp_alloc(type, 0);
|
||||||
if (!newObject)
|
if (!newObject)
|
||||||
return NULL;
|
return NULL;
|
||||||
newObject->environment = NULL;
|
|
||||||
|
|
||||||
return (PyObject*) newObject;
|
return (PyObject*) newObject;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -910,8 +910,6 @@ static udt_Subscription *Subscription_New(
|
|||||||
self->operations = operations;
|
self->operations = operations;
|
||||||
self->qos = qos;
|
self->qos = qos;
|
||||||
self->cqqos = cqqos;
|
self->cqqos = cqqos;
|
||||||
self->handle = NULL;
|
|
||||||
self->id = 0;
|
|
||||||
if (Subscription_Register(self) < 0) {
|
if (Subscription_Register(self) < 0) {
|
||||||
Py_DECREF(self);
|
Py_DECREF(self);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
14
Variable.c
14
Variable.c
@ -229,25 +229,11 @@ static udt_Variable *Variable_New(
|
|||||||
// perform basic initialization
|
// perform basic initialization
|
||||||
Py_INCREF(cursor->connection->environment);
|
Py_INCREF(cursor->connection->environment);
|
||||||
self->environment = cursor->connection->environment;
|
self->environment = cursor->connection->environment;
|
||||||
self->boundCursorHandle = NULL;
|
|
||||||
self->bindHandle = NULL;
|
|
||||||
self->defineHandle = NULL;
|
|
||||||
self->boundName = NULL;
|
|
||||||
self->inConverter = NULL;
|
|
||||||
self->outConverter = NULL;
|
|
||||||
self->boundPos = 0;
|
|
||||||
if (numElements < 1)
|
if (numElements < 1)
|
||||||
self->allocatedElements = 1;
|
self->allocatedElements = 1;
|
||||||
else self->allocatedElements = numElements;
|
else self->allocatedElements = numElements;
|
||||||
self->actualElements = 0;
|
|
||||||
self->internalFetchNum = 0;
|
|
||||||
self->isArray = 0;
|
|
||||||
self->isAllocatedInternally = 1;
|
self->isAllocatedInternally = 1;
|
||||||
self->type = type;
|
self->type = type;
|
||||||
self->indicator = NULL;
|
|
||||||
self->data = NULL;
|
|
||||||
self->actualLength = NULL;
|
|
||||||
self->returnCode = NULL;
|
|
||||||
|
|
||||||
// set the maximum length of the variable, ensure that a minimum of
|
// set the maximum length of the variable, ensure that a minimum of
|
||||||
// 2 bytes is allocated to ensure that the array size check works
|
// 2 bytes is allocated to ensure that the array size check works
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user