Skip to content

Commit

Permalink
new copy of keys
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jun 21, 2018
1 parent 12b5c3f commit a0c36fb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions src/pconvert/extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ void extension_build_params(PyObject *params_py, params *params) {
key_s = PyString_AsString(key);
#endif

params->length++;
params->params[index].key = key_s;
memcpy(
params->params[index].key,
key_s,
strlen(key_s) + 1
);

#if PY_MAJOR_VERSION >= 3
Py_DECREF(key);
#endif

if(PyBool_Check(value)) {
value_b = PyBool_Check(value);
Expand Down Expand Up @@ -221,8 +228,8 @@ PyObject *extension_blend_multiple(PyObject *self, PyObject *args, PyObject *kwa
first = PyList_GetItem(paths, 0);

#if PY_MAJOR_VERSION >= 3
encoded = PyUnicode_EncodeFSDefault(first);
bottom_path = PyBytes_AsString(encoded);
first = PyUnicode_EncodeFSDefault(first);
bottom_path = PyBytes_AsString(first);
#else
bottom_path = PyString_AsString(first);
#endif
Expand All @@ -241,7 +248,7 @@ PyObject *extension_blend_multiple(PyObject *self, PyObject *args, PyObject *kwa
);
Py_END_ALLOW_THREADS;
#if PY_MAJOR_VERSION >= 3
Py_DECREF(encoded);
Py_DECREF(first);
#endif
Py_RETURN_NONE;
}
Expand Down Expand Up @@ -332,6 +339,7 @@ PyObject *extension_blend_multiple(PyObject *self, PyObject *args, PyObject *kwa
#if PY_MAJOR_VERSION >= 3
Py_DECREF(first);
Py_DECREF(second);
if(use_algorithms) { Py_DECREF(algorithm_o); }
#endif

iterator = PyObject_GetIter(paths);
Expand Down Expand Up @@ -412,6 +420,7 @@ PyObject *extension_blend_multiple(PyObject *self, PyObject *args, PyObject *kwa
Py_DECREF(element);
#if PY_MAJOR_VERSION >= 3
Py_DECREF(encoded);
if(use_algorithms) { Py_DECREF(algorithm_o); }
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/pconvert/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ typedef union typem_t {
} typem;

typedef struct param_t {
char *key;
char key[32];
union typem_t value;
} param;

Expand Down

0 comments on commit a0c36fb

Please sign in to comment.