1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-01 04:58:35 +03:00

python: Remove const from PyList_AsStringList()

The returned strings are not owned by python, so need not be const.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15289

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 5afd206d1d8f0344a2f1fa7a238204d1fb164eda)
This commit is contained in:
Andrew Bartlett 2023-07-21 14:32:46 +12:00 committed by Jule Anger
parent 2ed3913687
commit 534425ba2f
3 changed files with 8 additions and 8 deletions

View File

@ -72,16 +72,16 @@ error:
return false;
}
const char **PyList_AsStringList(TALLOC_CTX *mem_ctx, PyObject *list,
char **PyList_AsStringList(TALLOC_CTX *mem_ctx, PyObject *list,
const char *paramname)
{
const char **ret;
char **ret;
Py_ssize_t i;
if (!PyList_Check(list)) {
PyErr_Format(PyExc_TypeError, "%s is not a list", paramname);
return NULL;
}
ret = talloc_array(NULL, const char *, PyList_Size(list)+1);
ret = talloc_array(NULL, char *, PyList_Size(list)+1);
if (ret == NULL) {
PyErr_NoMemory();
return NULL;

View File

@ -26,7 +26,7 @@ bool py_update_path(void);
/* discard signature of 'func' in favour of 'target_sig' */
#define PY_DISCARD_FUNC_SIG(target_sig, func) (target_sig)(void(*)(void))func
const char **PyList_AsStringList(TALLOC_CTX *mem_ctx, PyObject *list,
char **PyList_AsStringList(TALLOC_CTX *mem_ctx, PyObject *list,
const char *paramname);
#endif /* __SAMBA_PYTHON_MODULES_H__ */

View File

@ -367,7 +367,7 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec
struct tevent_context *ev;
struct ldb_context *ldb = NULL;
NTSTATUS nt_status;
const char **methods;
const char *const *methods;
const char *const kwnames[] = {"lp_ctx", "ldb", "methods", NULL};
@ -413,7 +413,7 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec
mem_ctx, ev, NULL, lp_ctx, &auth_context);
} else {
if (py_methods != Py_None) {
methods = PyList_AsStringList(mem_ctx, py_methods, "methods");
methods = (const char * const *)PyList_AsStringList(mem_ctx, py_methods, "methods");
if (methods == NULL) {
talloc_free(mem_ctx);
return NULL;