Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5c6f55e

Browse filesBrowse files
authored
Save string length instead of calling strlen in cxoCursor_var (#438)
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
1 parent 0b39b9e commit 5c6f55e
Copy full SHA for 5c6f55e

File tree

Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed

‎src/cxoCursor.c

Copy file name to clipboardExpand all lines: src/cxoCursor.c
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,6 +1838,7 @@ static PyObject *cxoCursor_var(cxoCursor *cursor, PyObject *args,
18381838
PyObject *inConverter, *outConverter, *typeNameObj;
18391839
cxoTransformNum transformNum;
18401840
const char *encodingErrors;
1841+
Py_ssize_t encodingErrorsLen;
18411842
cxoObjectType *objType;
18421843
int size, arraySize;
18431844
PyObject *type;
@@ -1848,9 +1849,9 @@ static PyObject *cxoCursor_var(cxoCursor *cursor, PyObject *args,
18481849
encodingErrors = NULL;
18491850
arraySize = cursor->bindArraySize;
18501851
inConverter = outConverter = typeNameObj = NULL;
1851-
if (!PyArg_ParseTupleAndKeywords(args, keywordArgs, "O|iiOOOz",
1852+
if (!PyArg_ParseTupleAndKeywords(args, keywordArgs, "O|iiOOOz#",
18521853
keywordList, &type, &size, &arraySize, &inConverter, &outConverter,
1853-
&typeNameObj, &encodingErrors))
1854+
&typeNameObj, &encodingErrors, &encodingErrorsLen))
18541855
return NULL;
18551856

18561857
// determine the type of variable
@@ -1875,7 +1876,7 @@ static PyObject *cxoCursor_var(cxoCursor *cursor, PyObject *args,
18751876

18761877
// assign encoding errors, if applicable
18771878
if (encodingErrors) {
1878-
var->encodingErrors = PyMem_Malloc(strlen(encodingErrors) + 1);
1879+
var->encodingErrors = PyMem_Malloc(encodingErrorsLen + 1);
18791880
if (!var->encodingErrors) {
18801881
Py_DECREF(var);
18811882
return NULL;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.