1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 03:05:43 +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
+1 -1
View File
@@ -2411,7 +2411,7 @@ void
command_set_display_option (struct t_config_option *option,
const char *message)
{
char *color_name;
const char *color_name;
switch (option->type)
{
+3 -3
View File
@@ -1412,7 +1412,7 @@ config_file_option_integer (struct t_config_option *option)
* config_file_option_string: return string value of an option
*/
char *
const char *
config_file_option_string (struct t_config_option *option)
{
if (!option)
@@ -1443,7 +1443,7 @@ config_file_option_string (struct t_config_option *option)
* config_file_option_color: return color value of an option
*/
char *
const char *
config_file_option_color (struct t_config_option *option)
{
if (!option)
@@ -2412,7 +2412,7 @@ config_file_print_stdout (struct t_config_file *config_file)
{
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char *color_name;
const char *color_name;
int i;
for (ptr_section = config_file->sections; ptr_section;
+2 -2
View File
@@ -228,8 +228,8 @@ extern int config_file_option_set_with_string (const char *option_name, const ch
extern int config_file_option_unset_with_string (const char *option_name);
extern int config_file_option_boolean (struct t_config_option *option);
extern int config_file_option_integer (struct t_config_option *option);
extern char *config_file_option_string (struct t_config_option *option);
extern char *config_file_option_color (struct t_config_option *option);
extern const char *config_file_option_string (struct t_config_option *option);
extern const char *config_file_option_color (struct t_config_option *option);
extern void config_file_write_line (struct t_config_file *config_file,
const char *option_name, const char *value, ...);
+2 -2
View File
@@ -1470,12 +1470,12 @@ hook_info (struct t_weechat_plugin *plugin, const char *info_name,
* hook_info_get: get info via info hook
*/
char *
const char *
hook_info_get (struct t_weechat_plugin *plugin, const char *info_name,
const char *arguments)
{
struct t_hook *ptr_hook, *next_hook;
char *value;
const char *value;
/* make C compiler happy */
(void) plugin;
+5 -5
View File
@@ -198,8 +198,8 @@ struct t_hook_modifier
char *modifier; /* name of modifier */
};
typedef char *(t_hook_callback_info)(void *data, const char *info_name,
const char *arguments);
typedef const char *(t_hook_callback_info)(void *data, const char *info_name,
const char *arguments);
struct t_hook_info
{
@@ -305,9 +305,9 @@ extern struct t_hook *hook_info (struct t_weechat_plugin *plugin,
const char *description,
t_hook_callback_info *callback,
void *callback_data);
extern char *hook_info_get (struct t_weechat_plugin *plugin,
const char *info_name,
const char *arguments);
extern const char *hook_info_get (struct t_weechat_plugin *plugin,
const char *info_name,
const char *arguments);
extern struct t_hook *hook_infolist (struct t_weechat_plugin *plugin,
const char *infolist_name,
const char *description,
+2 -2
View File
@@ -331,7 +331,7 @@ infolist_reset_item_cursor (struct t_infolist *infolist)
* infolist_fields: get list of fields for current infolist item
*/
char *
const char *
infolist_fields (struct t_infolist *infolist)
{
struct t_infolist_var *ptr_var;
@@ -417,7 +417,7 @@ infolist_integer (struct t_infolist *infolist, const char *var)
* infolist_string: get a string variable value in current list item
*/
char *
const char *
infolist_string (struct t_infolist *infolist, const char *var)
{
struct t_infolist_var *ptr_var;
+2 -2
View File
@@ -88,10 +88,10 @@ extern int infolist_valid (struct t_infolist *infolist);
extern struct t_infolist_item *infolist_next (struct t_infolist *infolist);
extern struct t_infolist_item *infolist_prev (struct t_infolist *infolist);
extern void infolist_reset_item_cursor (struct t_infolist *infolist);
extern char *infolist_fields (struct t_infolist *infolist);
extern const char *infolist_fields (struct t_infolist *infolist);
extern int infolist_integer (struct t_infolist *infolist,
const char *var);
extern char *infolist_string (struct t_infolist *infolist,
extern const char *infolist_string (struct t_infolist *infolist,
const char *var);
extern void *infolist_pointer (struct t_infolist *infolist,
const char *var);
+1 -1
View File
@@ -293,7 +293,7 @@ weelist_prev (struct t_weelist_item *item)
* weelist_string: get string pointer to item data
*/
char *
const char *
weelist_string (struct t_weelist_item *item)
{
if (item)
+1 -1
View File
@@ -47,7 +47,7 @@ extern struct t_weelist_item *weelist_get (struct t_weelist *weelist,
extern void weelist_set (struct t_weelist_item *item, const char *value);
extern struct t_weelist_item *weelist_next (struct t_weelist_item *item);
extern struct t_weelist_item *weelist_prev (struct t_weelist_item *item);
extern char *weelist_string (struct t_weelist_item *item);
extern const char *weelist_string (struct t_weelist_item *item);
extern int weelist_size (struct t_weelist *weelist);
extern void weelist_remove (struct t_weelist *weelist,
struct t_weelist_item *item);
+4 -2
View File
@@ -116,7 +116,8 @@ upgrade_file_write_time (struct t_upgrade_file *upgrade_file, time_t date)
*/
int
upgrade_file_write_string (struct t_upgrade_file *upgrade_file, char *string)
upgrade_file_write_string (struct t_upgrade_file *upgrade_file,
const char *string)
{
int length;
@@ -239,7 +240,8 @@ upgrade_file_write_object (struct t_upgrade_file *upgrade_file, int object_id,
struct t_infolist *infolist)
{
int i, argc, length;
char *fields, **argv;
char **argv;
const char *fields;
void *buf;
/* write all infolist variables */
+2 -2
View File
@@ -279,8 +279,8 @@ int
upgrade_weechat_read_cb (int object_id,
struct t_infolist *infolist)
{
char *type, *name, *prefix, *group_name, option_name[64], *key;
char *option_key, *var_name, *option_var;
const char *key, *var_name, *type, *name, *prefix, *group_name;
char option_name[64], *option_key, *option_var;
struct t_gui_nick_group *ptr_group;
struct t_gui_buffer *ptr_buffer;
struct t_gui_line *new_line;
+1 -1
View File
@@ -262,7 +262,7 @@ gui_color_get_number ()
* gui_color_get_name: get color name
*/
char *
const char *
gui_color_get_name (int num_color)
{
return gui_weechat_colors[num_color].string;
+1 -1
View File
@@ -114,7 +114,7 @@ gui_color_get_number ()
* gui_color_get_name: get color name
*/
char *
const char *
gui_color_get_name (int num_color)
{
return gui_weechat_colors[num_color].string;
+2 -2
View File
@@ -819,7 +819,7 @@ gui_bar_item_default_buffer_plugin (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height)
{
char *plugin_name;
const char *plugin_name;
/* make C compiler happy */
(void) data;
@@ -829,7 +829,7 @@ gui_bar_item_default_buffer_plugin (void *data, struct t_gui_bar_item *item,
if (!window)
window = gui_current_window;
plugin_name = plugin_get_name (window->buffer->plugin);
return (plugin_name) ? strdup (plugin_name) : strdup ("");
}
+1 -1
View File
@@ -539,7 +539,7 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property)
* gui_buffer_get_string: get a buffer property as string
*/
char *
const char *
gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
{
struct t_gui_buffer_local_var *ptr_local_var;
+2 -2
View File
@@ -198,8 +198,8 @@ extern void gui_buffer_set_plugin_for_upgrade (char *name,
struct t_weechat_plugin *plugin);
extern int gui_buffer_get_integer (struct t_gui_buffer *buffer,
const char *property);
extern char *gui_buffer_get_string (struct t_gui_buffer *buffer,
const char *property);
extern const char *gui_buffer_get_string (struct t_gui_buffer *buffer,
const char *property);
extern void *gui_buffer_get_pointer (struct t_gui_buffer *buffer,
const char *property);
extern void gui_buffer_ask_chat_refresh (struct t_gui_buffer *buffer,
+2 -2
View File
@@ -77,7 +77,7 @@ gui_color_search_config_int (const char *color_name)
* return color configuration name, NULL if not found
*/
char *
const char *
gui_color_search_config_str (int color_number)
{
struct t_config_section *ptr_section;
@@ -103,7 +103,7 @@ gui_color_search_config_str (int color_number)
* gui_color_get_custom: get a custom color with a name (GUI dependent)
*/
char *
const char *
gui_color_get_custom (const char *color_name)
{
int fg, bg;
+3 -3
View File
@@ -123,8 +123,8 @@ extern struct t_gui_color *gui_color[];
/* color functions */
extern int gui_color_search_config_int (const char *color_name);
extern char *gui_color_search_config_str (int color_number);
extern char *gui_color_get_custom (const char *color_name);
extern const char *gui_color_search_config_str (int color_number);
extern const char *gui_color_get_custom (const char *color_name);
extern unsigned char *gui_color_decode (const unsigned char *string);
extern void gui_color_free (struct t_gui_color *color);
@@ -133,7 +133,7 @@ extern void gui_color_free (struct t_gui_color *color);
extern int gui_color_search (const char *color_name);
extern int gui_color_assign (int *color, char const *color_name);
extern int gui_color_get_number ();
extern char *gui_color_get_name (int num_color);
extern const char *gui_color_get_name (int num_color);
extern void gui_color_init_pairs ();
extern void gui_color_init_weechat ();
+2 -1
View File
@@ -700,8 +700,9 @@ gui_completion_list_add_plugin_commands (struct t_gui_completion *completion)
void
gui_completion_list_add_option_value (struct t_gui_completion *completion)
{
char *pos_space, *option_full_name, *color_name, *pos_section, *pos_option;
char *pos_space, *option_full_name, *pos_section, *pos_option;
char *file, *section, *value_string;
const char *color_name;
int length, i, num_colors;
struct t_config_file *ptr_config;
struct t_config_section *ptr_section, *section_found;
+3 -3
View File
@@ -184,7 +184,7 @@ void
gui_layout_buffer_apply ()
{
struct t_gui_buffer *ptr_buffer;
char *plugin_name;
const char *plugin_name;
if (gui_layout_buffers)
{
@@ -408,7 +408,7 @@ void
gui_layout_window_check_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_window *ptr_win;
char *plugin_name;
const char *plugin_name;
plugin_name = plugin_get_name (buffer->plugin);
@@ -436,7 +436,7 @@ gui_layout_window_check_all_buffers ()
{
struct t_gui_window *ptr_win;
struct t_gui_buffer *ptr_buffer;
char *plugin_name;
const char *plugin_name;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
+1 -1
View File
@@ -300,7 +300,7 @@ gui_window_get_integer (struct t_gui_window *window, const char *property)
* gui_window_get_string: get a window property as string
*/
char *
const char *
gui_window_get_string (struct t_gui_window *window, const char *property)
{
if (window && property)
+2 -2
View File
@@ -103,8 +103,8 @@ extern struct t_gui_window *gui_window_new (struct t_gui_window *parent,
extern int gui_window_valid (struct t_gui_window *window);
extern int gui_window_get_integer (struct t_gui_window *window,
const char *property);
extern char *gui_window_get_string (struct t_gui_window *window,
const char *property);
extern const char *gui_window_get_string (struct t_gui_window *window,
const char *property);
extern void *gui_window_get_pointer (struct t_gui_window *window,
const char *property);
extern void gui_window_set_layout_plugin_name (struct t_gui_window *window,
+1 -1
View File
@@ -57,7 +57,7 @@ void
weechat_aspell_config_change_commands (void *data,
struct t_config_option *option)
{
char *value;
const char *value;
int i;
/* make C compiler happy */
+7 -4
View File
@@ -158,7 +158,8 @@ struct t_aspell_code countries_avail[] =
char *
weechat_aspell_build_option_name (struct t_gui_buffer *buffer)
{
char *plugin_name, *name, *option_name;
const char *plugin_name, *name;
char *option_name;
int length;
if (!buffer)
@@ -183,7 +184,7 @@ weechat_aspell_build_option_name (struct t_gui_buffer *buffer)
* one to find dict (from specific to general dict)
*/
char *
const char *
weechat_aspell_get_dict (struct t_gui_buffer *buffer)
{
char *name, *option_name, *ptr_end;
@@ -307,7 +308,8 @@ weechat_aspell_spellers_already_ok (const char *dict_list)
void
weechat_aspell_create_spellers (struct t_gui_buffer *buffer)
{
char *dict_list, **argv;
const char *dict_list;
char **argv;
int argc, i;
if (buffer)
@@ -713,7 +715,8 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
const char *modifier_data, const char *string)
{
struct t_gui_buffer *buffer;
char *result, *ptr_string, *pos_space, *color_normal, *color_error;
char *result, *ptr_string, *pos_space;
const char *color_normal, *color_error;
int length, index_result, length_word, word_ok;
int length_color_normal, length_color_error;
+7 -6
View File
@@ -50,8 +50,8 @@ struct t_config_option *charset_default_encode = NULL;
struct t_config_section *charset_config_section_decode = NULL;
struct t_config_section *charset_config_section_encode = NULL;
char *charset_terminal = NULL;
char *charset_internal = NULL;
const char *charset_terminal = NULL;
const char *charset_internal = NULL;
/*
@@ -250,7 +250,7 @@ charset_check (const char *charset)
* to find charset (from specific to general charset)
*/
char *
const char *
charset_get (struct t_config_section *section, const char *name,
struct t_config_option *default_charset)
{
@@ -306,7 +306,7 @@ char *
charset_decode_cb (void *data, const char *modifier, const char *modifier_data,
const char *string)
{
char *charset;
const char *charset;
/* make C compiler happy */
(void) data;
@@ -335,7 +335,7 @@ char *
charset_encode_cb (void *data, const char *modifier, const char *modifier_data,
const char *string)
{
char *charset;
const char *charset;
/* make C compiler happy */
(void) data;
@@ -389,7 +389,8 @@ charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
{
struct t_config_section *ptr_section;
int length;
char *ptr_charset, *option_name, *plugin_name, *name;
char *ptr_charset, *option_name;
const char *plugin_name, *name;
/* make C compiler happy */
(void) data;
+2 -1
View File
@@ -178,7 +178,8 @@ demo_buffer_set_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
void
demo_infolist_print (struct t_infolist *infolist, const char *item_name)
{
char *fields, **argv;
const char *fields;
char **argv;
void *pointer;
int i, j, argc, size;
time_t time;
+1 -1
View File
@@ -29,7 +29,7 @@
* fifo_info_get_info_cb: callback called when fifo info is asked
*/
char *
const char *
fifo_info_get_info_cb (void *data, const char *info_name,
const char *arguments)
{
+1 -1
View File
@@ -58,7 +58,7 @@ int
fifo_create ()
{
int rc, filename_length;
char *fifo_option, *weechat_home;
const char *fifo_option, *weechat_home;
rc = 0;
+4 -2
View File
@@ -42,7 +42,8 @@ irc_bar_item_buffer_title (void *data, struct t_gui_bar_item *item,
int max_width, int max_height)
{
struct t_gui_buffer *buffer;
char *title, *title_color;
const char *title;
char *title_color;
/* make C compiler happy */
(void) data;
@@ -78,7 +79,8 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height)
{
char buf[512], buf_name[256], modes[128], away[128], *name;
char buf[512], buf_name[256], modes[128], away[128];
const char *name;
int number, part_from_channel;
struct t_gui_buffer *buffer;
struct t_irc_server *server;
+1 -1
View File
@@ -123,7 +123,7 @@ char *
irc_buffer_get_server_prefix (struct t_irc_server *server, char *prefix_code)
{
static char buf[256];
char *prefix;
const char *prefix;
prefix = (prefix_code && prefix_code[0]) ?
weechat_prefix (prefix_code) : NULL;
+1 -1
View File
@@ -178,7 +178,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
*/
void
irc_channel_set_topic (struct t_irc_channel *channel, char *topic)
irc_channel_set_topic (struct t_irc_channel *channel, const char *topic)
{
if (channel->topic)
free (channel->topic);
+2 -1
View File
@@ -72,7 +72,8 @@ extern struct t_irc_channel *irc_channel_new (struct t_irc_server *server,
int channel_type,
const char *channel_name,
int switch_to_channel);
extern void irc_channel_set_topic (struct t_irc_channel *channel, char *topic);
extern void irc_channel_set_topic (struct t_irc_channel *channel,
const char *topic);
extern void irc_channel_free (struct t_irc_server *server,
struct t_irc_channel *channel);
extern void irc_channel_free_all (struct t_irc_server *server);
+6 -4
View File
@@ -790,7 +790,8 @@ int
irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *channel_name, *pos_args, *ptr_arg, *buf, *version;
char *channel_name, *pos_args, *buf;
const char *version, *ptr_arg;
char **channels;
int i, num_channels;
@@ -1139,8 +1140,8 @@ irc_command_die (void *data, struct t_gui_buffer *buffer, int argc,
void
irc_command_quit_server (struct t_irc_server *server, const char *arguments)
{
const char *ptr_arg;
char *buf, *version;
const char *ptr_arg, *version;
char *buf;
if (!server)
return;
@@ -2379,7 +2380,8 @@ irc_command_part_channel (struct t_irc_server *server, const char *channel_name,
const char *part_message)
{
const char *ptr_arg;
char *buf, *version;
char *buf;
const char *version;
ptr_arg = (part_message) ? part_message :
(weechat_config_string (irc_config_network_default_msg_part)
+1 -1
View File
@@ -187,7 +187,7 @@ irc_completion_channel_nicks_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_nick *ptr_nick;
char *nick;
const char *nick;
int list_size, i;
IRC_GET_SERVER_CHANNEL(buffer);
+2 -1
View File
@@ -415,7 +415,8 @@ irc_config_reload_servers_from_config ()
struct t_infolist *infolist;
struct t_irc_server *ptr_server;
struct t_config_option *ptr_option;
char *full_name, *option_name, *server_name, *pos_option;
const char *full_name, *option_name;
char *server_name, *pos_option;
int i, index_option;
infolist = weechat_infolist_get ("option", NULL, "irc.server.*");
+1 -1
View File
@@ -59,7 +59,7 @@ irc_info_create_string_with_pointer (char **string, void *pointer)
* irc_info_get_info_cb: callback called when IRC info is asked
*/
char *
const char *
irc_info_get_info_cb (void *data, const char *info_name,
const char *arguments)
{
+1 -1
View File
@@ -60,7 +60,7 @@ irc_nick_valid (struct t_irc_channel *channel, struct t_irc_nick *nick)
* irc_nick_find_color: find a color for a nick (according to nick letters)
*/
char *
const char *
irc_nick_find_color (struct t_irc_nick *nick)
{
int i, color;
+1 -1
View File
@@ -51,7 +51,7 @@ struct t_irc_nick
char *host; /* full hostname */
int flags; /* chanowner/chanadmin (unrealircd), */
/* op, halfop, voice, away */
char *color; /* color for nickname in chat window */
const char *color; /* color for nickname in chat window */
struct t_irc_nick *prev_nick; /* link to previous nick on channel */
struct t_irc_nick *next_nick; /* link to next nick on channel */
};
+6 -3
View File
@@ -1119,7 +1119,8 @@ irc_protocol_reply_version (struct t_irc_server *server,
struct t_irc_channel *channel, const char *nick,
const char *message, const char *str_version)
{
char *pos, *version, *date;
char *pos;
const char *version, *date;
struct t_gui_buffer *ptr_buffer;
ptr_buffer = (channel) ? channel->buffer : server->buffer;
@@ -3654,7 +3655,8 @@ int
irc_protocol_cmd_353 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_channel, *pos_nick, *color;
char *pos_channel, *pos_nick;
const char *color;
int args, i, prefix_found;
int is_chanowner, is_chanadmin, is_chanadmin2, is_op, is_halfop;
int has_voice, is_chanuser;
@@ -3785,7 +3787,8 @@ irc_protocol_cmd_366 (struct t_irc_server *server, const char *command,
struct t_infolist *infolist;
struct t_config_option *ptr_option;
int num_nicks, num_op, num_halfop, num_voice, num_normal, length, i;
char *string, *prefix;
char *string;
const char *prefix;
/* 366 message looks like:
:server 366 mynick #channel :End of /NAMES list.
+8 -6
View File
@@ -884,7 +884,8 @@ irc_server_duplicate (struct t_irc_server *server, const char *new_server_name)
{
struct t_irc_server *new_server;
int length, index_option;
char *mask, *option_name, *pos_option;
char *mask, *pos_option;
const char *option_name;
struct t_config_option *ptr_option;
struct t_infolist *infolist;
@@ -962,7 +963,8 @@ int
irc_server_rename (struct t_irc_server *server, const char *new_server_name)
{
int length;
char *mask, *option_name, *pos_option, *new_option_name, *buffer_name;
char *mask, *pos_option, *new_option_name, *buffer_name;
const char *option_name;
struct t_infolist *infolist;
struct t_config_option *ptr_option;
struct t_irc_channel *ptr_channel;
@@ -2157,7 +2159,7 @@ int
irc_server_connect (struct t_irc_server *server, int disable_autojoin)
{
int set;
char *config_proxy_type, *config_proxy_address;
const char *config_proxy_type, *config_proxy_address;
int config_proxy_use, config_proxy_ipv6, config_proxy_port;
if (!server->addresses || !server->addresses[0])
@@ -2678,7 +2680,7 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal,
{
struct t_infolist *infolist;
struct t_irc_server *server, *ptr_server;
char *plugin_name, *plugin_id, *type, *filename;
const char *plugin_name, *plugin_id, *type, *filename;
int spaces_in_name;
/* make C compiler happy */
@@ -2751,7 +2753,7 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal,
{
struct t_infolist *infolist;
struct t_irc_server *server, *ptr_server;
char *plugin_name, *plugin_id, *filename;
const char *plugin_name, *plugin_id, *filename;
int spaces_in_name;
/* make C compiler happy */
@@ -2808,7 +2810,7 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
{
struct t_infolist *infolist;
struct t_irc_server *server, *ptr_server;
char *plugin_name, *plugin_id, *filename;
const char *plugin_name, *plugin_id, *filename;
int spaces_in_name;
/* make C compiler happy */
+2 -1
View File
@@ -170,7 +170,8 @@ irc_upgrade_read_cb (int object_id,
struct t_infolist *infolist)
{
int flags, sock, size, index;
char *str, *buf, *buffer_name, option_name[64], *nick;
char *buf, option_name[64];
const char *buffer_name, *str, *nick;
struct t_irc_nick *ptr_nick;
struct t_gui_buffer *ptr_buffer;
+12 -7
View File
@@ -65,7 +65,8 @@ int
logger_create_directory ()
{
int rc;
char *dir1, *dir2, *weechat_dir;
char *dir1, *dir2;
const char *weechat_dir;
rc = 1;
@@ -104,7 +105,8 @@ logger_create_directory ()
char *
logger_build_option_name (struct t_gui_buffer *buffer)
{
char *plugin_name, *name, *option_name;
const char *plugin_name, *name;
char *option_name;
int length;
if (!buffer)
@@ -130,7 +132,8 @@ logger_build_option_name (struct t_gui_buffer *buffer)
int
logger_get_level_for_buffer (struct t_gui_buffer *buffer)
{
char *no_log, *name, *option_name, *ptr_end;
const char *no_log;
char *name, *option_name, *ptr_end;
struct t_config_option *ptr_option;
/* no log for buffer if local variable "no_log" is defined for buffer */
@@ -184,7 +187,7 @@ logger_get_level_for_buffer (struct t_gui_buffer *buffer)
* one to find mask (from specific to general mask)
*/
char *
const char *
logger_get_mask_for_buffer (struct t_gui_buffer *buffer)
{
char *name, *option_name, *ptr_end;
@@ -242,7 +245,9 @@ logger_get_mask_for_buffer (struct t_gui_buffer *buffer)
char *
logger_get_filename (struct t_gui_buffer *buffer)
{
char *res, *mask, *mask_decoded, *dir_separator, *weechat_dir;
char *res, *mask_decoded;
const char *mask;
const char *dir_separator, *weechat_dir;
char *log_path, *log_path2, *pos_last_sep;
int length;
@@ -353,10 +358,10 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
const char *format, ...)
{
va_list argptr;
char *charset, *message;
char *message, buf_time[256];
const char *charset;
time_t seconds;
struct tm *date_tmp;
char buf_time[256];
int log_level;
if (!logger_buf_write)
+2 -1
View File
@@ -76,7 +76,8 @@ notify_search (const char *notify_name)
char *
notify_build_option_name (struct t_gui_buffer *buffer)
{
char *option_name, *plugin_name, *name;
const char *plugin_name, *name;
char *option_name;
int length;
plugin_name = weechat_buffer_get_string (buffer, "plugin");
+8 -8
View File
@@ -70,7 +70,7 @@ plugin_api_charset_set (struct t_weechat_plugin *plugin, const char *charset)
* plugin_api_gettext: translate a string using gettext
*/
char *
const char *
plugin_api_gettext (const char *string)
{
return _(string);
@@ -80,7 +80,7 @@ plugin_api_gettext (const char *string)
* plugin_api_ngettext: translate a string using gettext
*/
char *
const char *
plugin_api_ngettext (const char *single, const char *plural, int count)
{
return NG_(single, plural, count);
@@ -104,7 +104,7 @@ plugin_api_config_get (const char *option_name)
* plugin_api_config_get_plugin: get value of a plugin config option
*/
char *
const char *
plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
const char *option_name)
{
@@ -142,7 +142,7 @@ plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
* plugin_api_prefix: return a prefix for display with printf
*/
char *
const char *
plugin_api_prefix (const char *prefix)
{
if (!prefix)
@@ -166,7 +166,7 @@ plugin_api_prefix (const char *prefix)
* plugin_api_color: return a WeeChat color for display with printf
*/
char *
const char *
plugin_api_color (const char *color_name)
{
int num_color;
@@ -207,7 +207,7 @@ plugin_api_command (struct t_weechat_plugin *plugin,
* plugin_api_info_get_inernal: get info about WeeChat
*/
char *
const char *
plugin_api_info_get_internal (void *data, const char *info_name,
const char *arguments)
{
@@ -580,7 +580,7 @@ plugin_api_infolist_reset_item_cursor (struct t_infolist *infolist)
* plugin_api_infolist_fields: get list of fields for current list item
*/
char *
const char *
plugin_api_infolist_fields (struct t_infolist *infolist)
{
if (!infolist || !infolist_valid (infolist))
@@ -606,7 +606,7 @@ plugin_api_infolist_integer (struct t_infolist *infolist, const char *var)
* plugin_api_infolist_string: get a string variable value in current list item
*/
char *
const char *
plugin_api_infolist_string (struct t_infolist *infolist, const char *var)
{
if (!infolist || !infolist_valid (infolist) || !infolist->ptr_item)
+11 -10
View File
@@ -23,27 +23,28 @@
/* strings */
extern void plugin_api_charset_set (struct t_weechat_plugin *plugin,
const char *charset);
extern char *plugin_api_gettext (const char *string);
extern char *plugin_api_ngettext (const char *single, const char *plural,
int count);
extern const char *plugin_api_gettext (const char *string);
extern const char *plugin_api_ngettext (const char *single, const char *plural,
int count);
/* config */
extern struct t_config_option *plugin_api_config_get (const char *option_name);
extern char *plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
extern const char *plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
const char *option_name);
extern int plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
const char *option_name, const char *value);
/* display */
extern char *plugin_api_prefix (const char *prefix);
extern char *plugin_api_color (const char *color_name);
extern const char *plugin_api_prefix (const char *prefix);
extern const char *plugin_api_color (const char *color_name);
/* command */
extern void plugin_api_command (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command);
/* infos */
extern char *plugin_api_info_get (struct t_weechat_plugin *plugin, const char *info);
extern const char *plugin_api_info_get (struct t_weechat_plugin *plugin,
const char *info);
/* infolists */
extern struct t_infolist *plugin_api_infolist_get (const char *name,
@@ -52,11 +53,11 @@ extern struct t_infolist *plugin_api_infolist_get (const char *name,
extern int plugin_api_infolist_next (struct t_infolist *infolist);
extern int plugin_api_infolist_prev (struct t_infolist *infolist);
extern void plugin_api_infolist_reset_item_cursor (struct t_infolist *infolist);
extern char *plugin_api_infolist_fields (struct t_infolist *infolist);
extern const char *plugin_api_infolist_fields (struct t_infolist *infolist);
extern int plugin_api_infolist_integer (struct t_infolist *infolist,
const char *var);
extern char *plugin_api_infolist_string (struct t_infolist *infolist,
const char *var);
extern const char *plugin_api_infolist_string (struct t_infolist *infolist,
const char *var);
extern void *plugin_api_infolist_pointer (struct t_infolist *infolist,
const char *var);
extern void *plugin_api_infolist_buffer (struct t_infolist *infolist,
+1 -1
View File
@@ -114,7 +114,7 @@ plugin_search (const char *name)
* plugin_get_name: get name of plugin with a pointer
*/
char *
const char *
plugin_get_name (struct t_weechat_plugin *plugin)
{
static char *plugin_core = PLUGIN_CORE;
+1 -1
View File
@@ -33,7 +33,7 @@ extern struct t_weechat_plugin *last_weechat_plugin;
extern int plugin_valid (struct t_weechat_plugin *plugin);
extern struct t_weechat_plugin *plugin_search (const char *name);
extern char *plugin_get_name (struct t_weechat_plugin *plugin);
extern const char *plugin_get_name (struct t_weechat_plugin *plugin);
extern struct t_weechat_plugin *plugin_load (const char *filename);
extern void plugin_auto_load ();
extern void plugin_remove (struct t_weechat_plugin *plugin);
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
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -76,7 +76,8 @@ xfer_file_resume (struct t_xfer *xfer, const char *filename)
void
xfer_file_find_filename (struct t_xfer *xfer)
{
char *weechat_home, *dir1, *dir2, *filename2, *dir_separator;
const char *weechat_home, *dir_separator;
char *dir1, *dir2, *filename2;
if (!XFER_IS_FILE(xfer->type))
return;
+8 -6
View File
@@ -125,7 +125,8 @@ xfer_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
void
xfer_create_directories ()
{
char *weechat_dir, *dir1, *dir2;
const char *weechat_dir;
char *dir1, *dir2;
/* create download directory */
weechat_dir = weechat_info_get ("weechat_dir", "");
@@ -655,10 +656,11 @@ int
xfer_add_cb (void *data, const char *signal, const char *type_data, void *signal_data)
{
struct t_infolist *infolist;
char *plugin_name, *plugin_id, *str_type, *str_protocol;
char *remote_nick, *local_nick, *filename;
const char *plugin_name, *plugin_id, *str_type, *str_protocol;
const char *remote_nick, *local_nick, *filename;
int type, protocol;
char *weechat_dir, *dir1, *dir2, *filename2, *short_filename, *pos;
const char *weechat_dir;
char *dir1, *dir2, *filename2, *short_filename, *pos;
int spaces, args, port_start, port_end;
struct stat st;
int sock, port;
@@ -1010,7 +1012,7 @@ xfer_start_resume_cb (void *data, const char *signal, const char *type_data,
{
struct t_infolist *infolist;
struct t_xfer *ptr_xfer;
char *plugin_name, *plugin_id, *filename, *str_start_resume;
const char *plugin_name, *plugin_id, *filename, *str_start_resume;
int port;
unsigned long start_resume;
@@ -1090,7 +1092,7 @@ xfer_accept_resume_cb (void *data, const char *signal, const char *type_data,
{
struct t_infolist *infolist;
struct t_xfer *ptr_xfer;
char *plugin_name, *plugin_id, *filename, *str_start_resume;
const char *plugin_name, *plugin_id, *filename, *str_start_resume;
int port;
unsigned long start_resume;