mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 21:36:37 +02:00
Use of const for some functions returning "char *"
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.*");
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
};
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user