From f56e4f09f366ff747bb6211994bc02927b426952 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sun, 30 Jan 2022 18:48:53 +0100 Subject: [PATCH] [python] static char[] --- src/scripting/python/dialogs.c | 14 ++++++++++++-- src/scripting/python/keybinding.c | 7 ++++++- src/scripting/python/menu.c | 6 +++++- src/scripting/python/open.c | 7 ++++++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/scripting/python/dialogs.c b/src/scripting/python/dialogs.c index 5eeff8e1c..90b53bcb2 100644 --- a/src/scripting/python/dialogs.c +++ b/src/scripting/python/dialogs.c @@ -44,7 +44,11 @@ python_info_box(PyObject *self, PyObject *args, PyObject *kwargs) char *title = N_("Info"); PyObject *object, *string_object; char *text; - static char *kwlist[] = {"text", "title", NULL}; + + static char s_text[] = "text"; + static char s_title[] = "title"; + + static char *kwlist[] = {s_text, s_title, NULL}; if (!python_ses) { PyErr_SetString(python_elinks_err, "No session"); @@ -172,7 +176,13 @@ python_input_box(PyObject *self, PyObject *args, PyObject *kwargs) char *title = N_("User dialog"); char *initial = NULL; struct python_input_callback_hop *hop; - static char *kwlist[] = {"prompt", "callback", "title", "initial", NULL}; + + static char s_prompt[] = "prompt"; + static char s_callback[] = "callback"; + static char s_title[] = "title"; + static char s_initial[] = "initial"; + + static char *kwlist[] = {s_prompt, s_callback, s_title, s_initial, NULL}; if (!python_ses) { PyErr_SetString(python_elinks_err, "No session"); diff --git a/src/scripting/python/keybinding.c b/src/scripting/python/keybinding.c index 208bd3d27..950904a33 100644 --- a/src/scripting/python/keybinding.c +++ b/src/scripting/python/keybinding.c @@ -88,7 +88,12 @@ python_bind_key(PyObject *self, PyObject *args, PyObject *kwargs) struct string event_name; int event_id; char *error_msg; - static char *kwlist[] = {"keystroke", "callback", "keymap", NULL}; + + static char s_keystroke[] = "keystroke"; + static char s_callback[] = "callback"; + static char s_keymap[] = "keymap"; + + static char *kwlist[] = {s_keystroke, s_callback, s_keymap, NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO|s:bind_key", kwlist, &keystroke, &callback, &keymap)) diff --git a/src/scripting/python/menu.c b/src/scripting/python/menu.c index bcd058685..52cd9bcd2 100644 --- a/src/scripting/python/menu.c +++ b/src/scripting/python/menu.c @@ -77,7 +77,11 @@ python_menu(PyObject *self, PyObject *args, PyObject *kwargs) int i; struct menu_item *menu; struct memory_list *ml = NULL; - static char *kwlist[] = {"items", "type", NULL}; + + static char s_items[] = "items"; + static char s_type[] = "type"; + + static char *kwlist[] = {s_items, s_type, NULL}; if (!python_ses) { PyErr_SetString(python_elinks_err, "No session"); diff --git a/src/scripting/python/open.c b/src/scripting/python/open.c index d76866d08..a94000f48 100644 --- a/src/scripting/python/open.c +++ b/src/scripting/python/open.c @@ -43,7 +43,12 @@ python_open(PyObject *self, PyObject *args, PyObject *kwargs) char *url; int new_tab = 0, background = 0; struct uri *uri; - static char *kwlist[] = {"url", "new_tab", "background", NULL}; + + static char s_url[] = "url"; + static char s_new_tab[] = "new_tab"; + static char s_background[] = "background"; + + static char *kwlist[] = {s_url, s_new_tab, s_background, NULL}; if (!python_ses) { PyErr_SetString(python_elinks_err, "No session");