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)
return false;
}
-const char **PyList_AsStringList(TALLOC_CTX *mem_ctx, PyObject *list,
- const char *paramname)
+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;
/* 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,
- const char *paramname);
+char **PyList_AsStringList(TALLOC_CTX *mem_ctx, PyObject *list,
+ const char *paramname);
#endif /* __SAMBA_PYTHON_MODULES_H__ */
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};
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;