From 45ce7480ea58fbe70a386dd6a5bb96eef5618512 Mon Sep 17 00:00:00 2001 From: "alexey.stratulat" <alexey.stratulat@demlabs.net> Date: Mon, 16 Dec 2019 15:18:02 +0700 Subject: [PATCH] [+] Added wrapping function dap_chain_hash_fast_to_str_new --- include/wrapping_dap_hash.h | 2 ++ src/wrapping_dap_hash.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/wrapping_dap_hash.h b/include/wrapping_dap_hash.h index 1d80fab5..701b5cc4 100644 --- a/include/wrapping_dap_hash.h +++ b/include/wrapping_dap_hash.h @@ -77,6 +77,7 @@ PyObject *dap_hash_fast_py(PyObject *self, PyObject *args); PyObject *dap_hash_fast_compare_py(PyObject *self, PyObject *args); PyObject *dap_hash_fast_is_blank_py(PyObject *self, PyObject *args); PyObject *dap_chain_hash_fast_to_str_py(PyObject *self, PyObject *args); +PyObject *dap_chain_hash_fast_to_str_new_py(PyObject *self, PyObject *args); static PyMethodDef DapHashFastMethods[] = { {"strToHashFast", (PyCFunction)dap_chain_str_to_hash_fast_py, METH_VARARGS | METH_STATIC, ""}, @@ -84,6 +85,7 @@ static PyMethodDef DapHashFastMethods[] = { {"compare", (PyCFunction)dap_hash_fast_compare_py, METH_VARARGS | METH_STATIC, ""}, {"isBlank", (PyCFunction)dap_hash_fast_is_blank_py, METH_VARARGS, ""}, {"toStr", (PyCFunction)dap_chain_hash_fast_to_str_py, METH_VARARGS, ""}, + {"toStrNew", (PyCFunction)dap_chain_hash_fast_to_str_new_py, METH_VARARGS, ""}, {NULL, NULL, 0, NULL} }; diff --git a/src/wrapping_dap_hash.c b/src/wrapping_dap_hash.c index 06d1227e..c54f6f43 100644 --- a/src/wrapping_dap_hash.c +++ b/src/wrapping_dap_hash.c @@ -61,3 +61,8 @@ PyObject *dap_chain_hash_fast_to_str_py(PyObject *self, PyObject *args){ int res = dap_chain_hash_fast_to_str(((PyDapChainHashFastObject*)self)->hash_fast, str, str_max); return Py_BuildValue("sn", &str, &str_max); } + +PyObject *dap_chain_hash_fast_to_str_new_py(PyObject *self, PyObject *args){ + char *res = dap_chain_hash_fast_to_str_new(((PyDapChainHashFastObject*)self)->hash_fast); + return Py_BuildValue("s", res); +} -- GitLab