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

core: fix some styles

This commit is contained in:
Sébastien Helleu
2018-01-07 09:11:45 +01:00
parent 91f792416b
commit 7ee88fb46c
58 changed files with 283 additions and 282 deletions
+2 -2
View File
@@ -646,8 +646,8 @@ arraylist_clear (struct t_arraylist *arraylist)
arraylist->size_alloc = 0;
if (arraylist->size_alloc_min > 0)
{
arraylist->data = calloc(arraylist->size_alloc_min,
sizeof (*arraylist->data));
arraylist->data = calloc (arraylist->size_alloc_min,
sizeof (*arraylist->data));
if (!arraylist->data)
return 0;
arraylist->size_alloc = arraylist->size_alloc_min;
+10 -10
View File
@@ -999,7 +999,7 @@ COMMAND_CALLBACK(buffer)
/* close buffer */
if (string_strcasecmp (argv[1], "close") == 0)
{
weechat_buffer = gui_buffer_search_main();
weechat_buffer = gui_buffer_search_main ();
if (argc < 3)
{
@@ -5599,7 +5599,7 @@ command_set_display_option_list (const char *message, const char *search,
* if we are displaying only changed options, skip options plugins.*
* because they are all "changed" (default value is always empty string)
*/
if (display_only_changed && strcmp(ptr_config->name, "plugins") == 0)
if (display_only_changed && (strcmp (ptr_config->name, "plugins") == 0))
continue;
for (ptr_section = ptr_config->sections; ptr_section;
ptr_section = ptr_section->next_section)
@@ -6266,7 +6266,7 @@ COMMAND_CALLBACK(uptime)
if ((argc >= 2) && (string_strcasecmp (argv[1], "-o") == 0))
{
snprintf (str_first_start, sizeof(str_first_start),
snprintf (str_first_start, sizeof (str_first_start),
"%s", ctime (&weechat_first_start_time));
if (str_first_start[0])
str_first_start[strlen (str_first_start) - 1] = '\0';
@@ -6342,20 +6342,20 @@ command_version_display (struct t_gui_buffer *buffer,
if (send_to_buffer_as_input && !translated_string)
{
snprintf (str_first_start, sizeof(str_first_start),
snprintf (str_first_start, sizeof (str_first_start),
"%s", ctime (&weechat_first_start_time));
if (str_first_start[0])
str_first_start[strlen (str_first_start) - 1] = '\0';
snprintf (str_last_start, sizeof(str_last_start),
snprintf (str_last_start, sizeof (str_last_start),
"%s", ctime (&weechat_last_start_time));
if (str_last_start[0])
str_last_start[strlen (str_last_start) - 1] = '\0';
}
else
{
snprintf (str_first_start, sizeof(str_first_start),
snprintf (str_first_start, sizeof (str_first_start),
"%s", util_get_time_string (&weechat_first_start_time));
snprintf (str_last_start, sizeof(str_last_start),
snprintf (str_last_start, sizeof (str_last_start),
"%s", util_get_time_string (&weechat_last_start_time));
}
}
@@ -8291,9 +8291,9 @@ command_startup (int plugins_loaded)
{
if (plugins_loaded)
{
command_exec_list(CONFIG_STRING(config_startup_command_after_plugins));
command_exec_list(weechat_startup_commands);
command_exec_list (CONFIG_STRING(config_startup_command_after_plugins));
command_exec_list (weechat_startup_commands);
}
else
command_exec_list(CONFIG_STRING(config_startup_command_before_plugins));
command_exec_list (CONFIG_STRING(config_startup_command_before_plugins));
}
+4 -4
View File
@@ -616,7 +616,7 @@ completion_list_add_commands_cb (const void *pointer, void *data,
{
if (pos)
{
snprintf (str_command, sizeof(str_command),
snprintf (str_command, sizeof (str_command),
"%s%s",
pos,
HOOK_COMMAND(ptr_hook, command));
@@ -1000,7 +1000,7 @@ completion_list_add_plugins_commands_cb (const void *pointer, void *data,
{
if (pos)
{
snprintf (str_command, sizeof(str_command),
snprintf (str_command, sizeof (str_command),
"%s%s",
pos,
HOOK_COMMAND(ptr_hook, command));
@@ -1017,7 +1017,7 @@ completion_list_add_plugins_commands_cb (const void *pointer, void *data,
}
}
string_free_split(argv);
string_free_split (argv);
return WEECHAT_RC_OK;
}
@@ -1281,7 +1281,7 @@ completion_list_add_weechat_commands_cb (const void *pointer, void *data,
{
if (pos)
{
snprintf (str_command, sizeof(str_command),
snprintf (str_command, sizeof (str_command),
"%s%s",
pos,
HOOK_COMMAND(ptr_hook, command));
+7 -7
View File
@@ -1947,7 +1947,7 @@ int config_file_option_has_changed (struct t_config_option *option)
case CONFIG_OPTION_TYPE_INTEGER:
return CONFIG_INTEGER(option) != CONFIG_INTEGER_DEFAULT(option);
case CONFIG_OPTION_TYPE_STRING:
return strcmp(CONFIG_STRING(option), CONFIG_STRING_DEFAULT(option)) != 0;
return strcmp (CONFIG_STRING(option), CONFIG_STRING_DEFAULT(option)) != 0;
case CONFIG_OPTION_TYPE_COLOR:
return CONFIG_COLOR(option) != CONFIG_COLOR_DEFAULT(option);
case CONFIG_NUM_OPTION_TYPES:
@@ -2668,7 +2668,7 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
{
undefined_value = 0;
/* remove simple or double quotes and spaces at the end */
if (strlen(pos) > 1)
if (strlen (pos) > 1)
{
pos2 = pos + strlen (pos) - 1;
while ((pos2 > pos) && (pos2[0] == ' '))
@@ -3203,11 +3203,11 @@ config_file_hdata_config_option_cb (const void *pointer, void *data,
*/
int
config_file_add_option_to_infolist(struct t_infolist *infolist,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option,
const char *option_name)
config_file_add_option_to_infolist (struct t_infolist *infolist,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option,
const char *option_name)
{
char *option_full_name, *value, *string_values;
struct t_config_option *ptr_parent_option;
+1 -1
View File
@@ -557,7 +557,7 @@ hdata_move (struct t_hdata *hdata, void *pointer, int count)
return NULL;
ptr_var = (count < 0) ? hdata->var_prev : hdata->var_next;
abs_count = abs(count);
abs_count = abs (count);
for (i = 0; i < abs_count; i++)
{
+3 -3
View File
@@ -1062,9 +1062,9 @@ hook_timer_init (struct t_hook *hook)
gettimeofday (&HOOK_TIMER(hook, last_exec), NULL);
time_now = time (NULL);
local_time = localtime(&time_now);
local_time = localtime (&time_now);
local_hour = local_time->tm_hour;
gm_time = gmtime(&time_now);
gm_time = gmtime (&time_now);
gm_hour = gm_time->tm_hour;
if ((local_time->tm_year > gm_time->tm_year)
|| (local_time->tm_mon > gm_time->tm_mon)
@@ -3680,7 +3680,7 @@ hook_set (struct t_hook *hook, const char *property, const char *value)
if (string_strcasecmp (property, "subplugin") == 0)
{
if (hook->subplugin)
free(hook->subplugin);
free (hook->subplugin);
hook->subplugin = strdup (value);
}
else if (string_strcasecmp (property, "stdin") == 0)
+1 -1
View File
@@ -273,7 +273,7 @@ log_crash_rename ()
local_time->tm_year + 1900,
local_time->tm_mon + 1,
local_time->tm_mday,
getpid());
getpid ());
if (rename (old_name, new_name) == 0)
{
string_fprintf (stderr, "*** Full crash dump was saved to %s file.\n",
+8 -8
View File
@@ -160,7 +160,7 @@ network_end ()
if (!weechat_no_gnutls)
{
gnutls_certificate_free_credentials (gnutls_xcred);
gnutls_global_deinit();
gnutls_global_deinit ();
}
#endif /* HAVE_GNUTLS */
network_init_gnutls_ok = 0;
@@ -321,7 +321,7 @@ network_resolve (const char *hostname, char *ip, int *version)
if (!res)
return 0;
if (getnameinfo (res->ai_addr, res->ai_addrlen, ipbuffer, sizeof(ipbuffer),
if (getnameinfo (res->ai_addr, res->ai_addrlen, ipbuffer, sizeof (ipbuffer),
NULL, 0, NI_NUMERICHOST) != 0)
{
freeaddrinfo (res);
@@ -494,9 +494,9 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
}
/* authentication successful then giving address/port to connect */
addr_len = strlen(address);
addr_len = strlen (address);
addr_buffer_len = 4 + 1 + addr_len + 2;
addr_buffer = malloc (addr_buffer_len * sizeof(*addr_buffer));
addr_buffer = malloc (addr_buffer_len * sizeof (*addr_buffer));
if (!addr_buffer)
return 0;
addr_buffer[0] = 5; /* version 5 */
@@ -984,7 +984,7 @@ network_connect_child (struct t_hook *hook_connect)
if (tmp_num_groups >= retry)
{
/* shuffle while adding */
rand_num = tmp_host + (rand() % ((i + 1) - tmp_host));
rand_num = tmp_host + (rand () % ((i + 1) - tmp_host));
if (rand_num == i)
res_reorder[i++] = ptr_res;
else
@@ -1015,7 +1015,7 @@ network_connect_child (struct t_hook *hook_connect)
if (tmp_num_groups < retry)
{
/* shuffle while adding */
rand_num = tmp_host + (rand() % ((i + 1) - tmp_host));
rand_num = tmp_host + (rand () % ((i + 1) - tmp_host));
if (rand_num == i)
res_reorder[i++] = ptr_res;
else
@@ -1208,7 +1208,7 @@ network_connect_child (struct t_hook *hook_connect)
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN(sizeof (sock));
memcpy(CMSG_DATA(cmsg), &sock, sizeof (sock));
memcpy (CMSG_DATA(cmsg), &sock, sizeof (sock));
msg.msg_controllen = cmsg->cmsg_len;
num_written = sendmsg (HOOK_CONNECT(hook_connect, child_send), &msg, 0);
(void) num_written;
@@ -1470,7 +1470,7 @@ network_connect_child_read_cb (const void *pointer, void *data, int fd)
&& cmsg->cmsg_type == SCM_RIGHTS
&& cmsg->cmsg_len >= sizeof (sock))
{
memcpy(&sock, CMSG_DATA(cmsg), sizeof (sock));
memcpy (&sock, CMSG_DATA(cmsg), sizeof (sock));
}
}
}
+5 -5
View File
@@ -2175,7 +2175,7 @@ string_split_command (const char *command, char separator)
nb_substr = 1;
ptr = command;
while ((p = strchr(ptr, separator)) != NULL)
while ((p = strchr (ptr, separator)) != NULL)
{
nb_substr++;
ptr = ++p;
@@ -2185,7 +2185,7 @@ string_split_command (const char *command, char separator)
if (!array)
return NULL;
buffer = malloc (strlen(command) + 1);
buffer = malloc (strlen (command) + 1);
if (!buffer)
{
free (array);
@@ -2195,7 +2195,7 @@ string_split_command (const char *command, char separator)
ptr = command;
str_idx = 0;
arr_idx = 0;
while(*ptr != '\0')
while (*ptr != '\0')
{
type = 0;
if (*ptr == separator)
@@ -2235,7 +2235,7 @@ string_split_command (const char *command, char separator)
free (buffer);
array2 = realloc (array, (arr_idx + 1) * sizeof(array[0]));
array2 = realloc (array, (arr_idx + 1) * sizeof (array[0]));
if (!array2)
{
if (array)
@@ -2288,7 +2288,7 @@ string_iconv (int from_utf8, const char *from_code, const char *to_code,
#ifdef HAVE_ICONV
if (from_code && from_code[0] && to_code && to_code[0]
&& (string_strcasecmp(from_code, to_code) != 0))
&& (string_strcasecmp (from_code, to_code) != 0))
{
cd = iconv_open (to_code, from_code);
if (cd == (iconv_t)(-1))
+2 -2
View File
@@ -871,7 +871,7 @@ weeurl_get_mask_value (struct t_url_constant *constants,
{
for (i = 0; i < num_items; i++)
{
item = string_remove_quotes(items[i], "'\"");
item = string_remove_quotes (items[i], "'\"");
if (item)
{
index = weeurl_search_constant (constants, item);
@@ -1115,7 +1115,7 @@ weeurl_download (const char *url, struct t_hashtable *options)
goto end;
}
curl = curl_easy_init();
curl = curl_easy_init ();
if (!curl)
{
rc = 3;
+2 -2
View File
@@ -138,7 +138,7 @@ utf8_is_valid (const char *string, int length, char **error)
{
goto invalid;
}
code_point = utf8_char_int(string);
code_point = utf8_char_int (string);
if ((code_point < 0x10000) || (code_point > 0x1FFFFF))
goto invalid;
string += 4;
@@ -433,7 +433,7 @@ utf8_char_size (const char *string)
/*
* Gets length of an UTF-8 string in number of chars (not bytes).
* Result is <= strlen(string).
* Result is <= strlen (string).
*
* Returns length of string (>= 0).
*/
+4 -4
View File
@@ -359,7 +359,7 @@ util_catch_signal (int signum, void (*handler)(int))
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
act.sa_handler = handler;
sigaction(signum, &act, NULL);
sigaction (signum, &act, NULL);
}
/*
@@ -562,7 +562,7 @@ util_search_full_lib_name_ext (const char *filename, const char *extension,
{
length = strlen (extra_libdir) + strlen (name_with_ext) +
strlen (plugins_dir) + 16;
final_name = malloc(length);
final_name = malloc (length);
if (!final_name)
{
free (name_with_ext);
@@ -719,7 +719,7 @@ util_file_get_content (const char *filename)
if (!buffer2)
goto error;
buffer = buffer2;
count = fread (&buffer[fp], sizeof(char), 1024, f);
count = fread (&buffer[fp], sizeof (char), 1024, f);
if (count <= 0)
goto error;
fp += count;
@@ -739,7 +739,7 @@ error:
if (buffer)
free (buffer);
if (f)
fclose(f);
fclose (f);
return NULL;
}
+2 -2
View File
@@ -159,7 +159,7 @@ weechat_display_usage ()
"(see /help upgrade in WeeChat)\n"
" -v, --version display WeeChat version\n"
" plugin:option option for plugin (see man weechat)\n"));
string_fprintf(stdout, "\n");
string_fprintf (stdout, "\n");
}
/*
@@ -594,7 +594,7 @@ weechat_shutdown (int return_code, int crash)
free (weechat_local_charset);
if (crash)
abort();
abort ();
else if (return_code >= 0)
exit (return_code);
}