1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 00:05:42 +02:00

Use of const for some functions returning "char *"

This commit is contained in:
Sebastien Helleu
2008-11-15 22:35:12 +01:00
parent e1d639d7eb
commit 8724fc18af
60 changed files with 895 additions and 290 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -263,7 +263,8 @@ weechat_python_load (const char *filename)
PyThreadState *python_current_interpreter;
PyObject *weechat_module, *weechat_outputs, *weechat_dict;
PyObject *python_path, *path;
char *w_home, *p_home;
const char *weechat_home;
char *p_home;
int len;
if ((fp = fopen (filename, "r")) == NULL)
@@ -315,14 +316,14 @@ weechat_python_load (const char *filename)
/* adding $weechat_dir/python in $PYTHONPATH */
python_path = PySys_GetObject ("path");
w_home = weechat_info_get ("weechat_dir", "");
if (w_home)
weechat_home = weechat_info_get ("weechat_dir", "");
if (weechat_home)
{
len = strlen (w_home) + 1 + strlen(PYTHON_PLUGIN_NAME) + 1;
len = strlen (weechat_home) + 1 + strlen(PYTHON_PLUGIN_NAME) + 1;
p_home = malloc (len);
if (p_home)
{
snprintf (p_home, len, "%s/python", w_home);
snprintf (p_home, len, "%s/python", weechat_home);
path = PyString_FromString (p_home);
if (path != NULL)
{
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -980,9 +980,9 @@ script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *info_name,
const char *description,
char *(*callback)(void *data,
const char *info_name,
const char *arguments),
const char *(*callback)(void *data,
const char *info_name,
const char *arguments),
const char *function)
{
struct t_script_callback *new_script_callback;
@@ -1316,12 +1316,13 @@ script_api_command (struct t_weechat_plugin *weechat_plugin,
* format in file is: plugin.script.option = value
*/
char *
const char *
script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *option)
{
char *option_fullname, *return_value;
char *option_fullname;
const char *return_value;
option_fullname = malloc ((strlen (script->name) +
strlen (option) + 2));
+6 -6
View File
@@ -180,9 +180,9 @@ extern struct t_hook *script_api_hook_info (struct t_weechat_plugin *weechat_plu
struct t_plugin_script *script,
const char *info_name,
const char *description,
char *(*callback)(void *data,
const char *info_name,
const char *arguments),
const char *(*callback)(void *data,
const char *info_name,
const char *arguments),
const char *function);
extern struct t_hook *script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
@@ -227,9 +227,9 @@ extern void script_api_command (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
const char *command);
extern char *script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *option);
extern const char *script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *option);
extern int script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *option, const char *value);
+5 -3
View File
@@ -44,7 +44,7 @@ int script_option_check_license = 0;
void
script_config_read (struct t_weechat_plugin *weechat_plugin)
{
char *string;
const char *string;
string = weechat_config_get_plugin (SCRIPT_OPTION_CHECK_LICENSE);
if (!string)
@@ -210,7 +210,8 @@ void
script_auto_load (struct t_weechat_plugin *weechat_plugin,
void (*callback)(void *data, const char *filename))
{
char *dir_home, *dir_name;
const char *dir_home;
char *dir_name;
int dir_length;
/* build directory, adding WeeChat home */
@@ -258,7 +259,8 @@ char *
script_search_full_name (struct t_weechat_plugin *weechat_plugin,
const char *filename)
{
char *final_name, *dir_home, *dir_system;
char *final_name;
const char *dir_home, *dir_system;
int length;
struct stat st;
File diff suppressed because it is too large Load Diff