From 4e1c26a3dc8df1064da853070c4302eff7ed7b78 Mon Sep 17 00:00:00 2001 From: Anthony Tuininga Date: Mon, 8 Feb 2016 10:32:11 -0700 Subject: [PATCH] Eliminate unnecessary initialization code. --- Connection.c | 1 - Environment.c | 3 --- ObjectType.c | 9 --------- SessionPool.c | 1 - Subscription.c | 2 -- Variable.c | 14 -------------- 6 files changed, 30 deletions(-) diff --git a/Connection.c b/Connection.c index cea40da..d582fa7 100644 --- a/Connection.c +++ b/Connection.c @@ -814,7 +814,6 @@ static PyObject* Connection_New( if (!self) return NULL; self->commitMode = OCI_DEFAULT; - self->environment = NULL; return (PyObject*) self; } diff --git a/Environment.c b/Environment.c index 2d5ad30..92406a5 100644 --- a/Environment.c +++ b/Environment.c @@ -72,11 +72,8 @@ static udt_Environment *Environment_New( env = (udt_Environment*) g_EnvironmentType.tp_alloc(&g_EnvironmentType, 0); if (!env) return NULL; - env->handle = NULL; - env->errorHandle = NULL; env->fixedWidth = 1; env->maxBytesPerCharacter = 1; - env->cloneEnv = NULL; cxBuffer_Init(&env->numberToStringFormatBuffer); cxBuffer_Init(&env->numberFromStringFormatBuffer); cxBuffer_Init(&env->nlsNumericCharactersBuffer); diff --git a/ObjectType.c b/ObjectType.c index afb67d8..4699306 100644 --- a/ObjectType.c +++ b/ObjectType.c @@ -363,13 +363,6 @@ static udt_ObjectType *ObjectType_New( return NULL; Py_INCREF(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) { Py_DECREF(self); return NULL; @@ -553,8 +546,6 @@ static udt_ObjectAttribute *ObjectAttribute_New( g_ObjectAttributeType.tp_alloc(&g_ObjectAttributeType, 0); if (!self) return NULL; - self->name = NULL; - self->subType = NULL; if (ObjectAttribute_Initialize(self, connection, param) < 0) { Py_DECREF(self); return NULL; diff --git a/SessionPool.c b/SessionPool.c index 8b9f228..1b5c111 100644 --- a/SessionPool.c +++ b/SessionPool.c @@ -160,7 +160,6 @@ static PyObject *SessionPool_New( newObject = (udt_SessionPool*) type->tp_alloc(type, 0); if (!newObject) return NULL; - newObject->environment = NULL; return (PyObject*) newObject; } diff --git a/Subscription.c b/Subscription.c index e52b24d..4c3998d 100644 --- a/Subscription.c +++ b/Subscription.c @@ -910,8 +910,6 @@ static udt_Subscription *Subscription_New( self->operations = operations; self->qos = qos; self->cqqos = cqqos; - self->handle = NULL; - self->id = 0; if (Subscription_Register(self) < 0) { Py_DECREF(self); return NULL; diff --git a/Variable.c b/Variable.c index 82b68ae..f43f86f 100644 --- a/Variable.c +++ b/Variable.c @@ -229,25 +229,11 @@ static udt_Variable *Variable_New( // perform basic initialization Py_INCREF(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) self->allocatedElements = 1; else self->allocatedElements = numElements; - self->actualElements = 0; - self->internalFetchNum = 0; - self->isArray = 0; self->isAllocatedInternally = 1; 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 // 2 bytes is allocated to ensure that the array size check works