Merge branch 'cleanup-warnings-split-3' into 'main'

Cleanup warnings split 3

See merge request GNOME/glib!2492
This commit is contained in:
Philip Withnall 2022-02-18 13:45:42 +00:00
commit a57c33fc1d
9 changed files with 47 additions and 47 deletions

View File

@ -936,7 +936,7 @@ g_array_binary_search (GArray *array,
{
gboolean result = FALSE;
GRealArray *_array = (GRealArray *) array;
guint left, middle, right;
guint left, middle = 0, right;
gint val;
g_return_val_if_fail (_array != NULL, FALSE);

View File

@ -1420,7 +1420,7 @@ static const guchar acceptable[96] = {
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x3F,0x20
};
static const gchar hex[16] = "0123456789ABCDEF";
static const gchar hex[] = "0123456789ABCDEF";
/* Note: This escape function works on file: URIs, but if you want to
* escape something else, please read RFC-2396 */

View File

@ -622,7 +622,7 @@ g_date_time_get_week_number (GDateTime *datetime,
gint *day_of_week,
gint *day_of_year)
{
gint a, b, c, d, e, f, g, n, s, month, day, year;
gint a, b, c, d, e, f, g, n, s, month = -1, day = -1, year = -1;
g_date_time_get_ymd (datetime, &year, &month, &day);
@ -2342,7 +2342,7 @@ g_date_time_get_day_of_month (GDateTime *datetime)
gint
g_date_time_get_week_numbering_year (GDateTime *datetime)
{
gint year, month, day, weekday;
gint year = -1, month = -1, day = -1, weekday;
g_date_time_get_ymd (datetime, &year, &month, &day);
weekday = g_date_time_get_day_of_week (datetime);

View File

@ -815,7 +815,7 @@ g_io_win32_check (GSource *source)
GIOWin32Watch *watch = (GIOWin32Watch *)source;
GIOWin32Channel *channel = (GIOWin32Channel *)watch->channel;
GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel);
WSANETWORKEVENTS events;
WSANETWORKEVENTS events = { 0 };
if (channel->debug)
g_print ("g_io_win32_check: source=%p channel=%p", source, channel);
@ -1452,7 +1452,7 @@ g_io_win32_sock_read (GIOChannel *channel,
GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
gint result;
GIOChannelError error;
int winsock_error;
int winsock_error = 0;
if (win32_channel->debug)
g_print ("g_io_win32_sock_read: channel=%p sock=%d count=%" G_GSIZE_FORMAT,
@ -1513,7 +1513,7 @@ g_io_win32_sock_write (GIOChannel *channel,
GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
gint result;
GIOChannelError error;
int winsock_error;
int winsock_error = 0;
if (win32_channel->debug)
g_print ("g_io_win32_sock_write: channel=%p sock=%d count=%" G_GSIZE_FORMAT,

View File

@ -1032,7 +1032,7 @@ emit_start_element (GMarkupParseContext *context,
*/
if ((context->flags & G_MARKUP_IGNORE_QUALIFIED) && strchr (current_element (context), ':'))
{
static const GMarkupParser ignore_parser;
static const GMarkupParser ignore_parser = { 0 };
g_markup_parse_context_push (context, &ignore_parser, NULL);
clear_attributes (context);
return;

View File

@ -610,7 +610,7 @@ magazine_count (ChunkLink *head)
#endif
static inline gsize
allocator_get_magazine_threshold (Allocator *allocator,
allocator_get_magazine_threshold (Allocator *local_allocator,
guint ix)
{
/* the magazine size calculated here has a lower bound of MIN_MAGAZINE_SIZE,
@ -622,9 +622,9 @@ allocator_get_magazine_threshold (Allocator *allocator,
* MAX_MAGAZINE_SIZE. for larger chunks, this number is scaled down so that
* the content of a single magazine doesn't exceed ca. 16KB.
*/
gsize chunk_size = SLAB_CHUNK_SIZE (allocator, ix);
guint threshold = MAX (MIN_MAGAZINE_SIZE, allocator->max_page_size / MAX (5 * chunk_size, 5 * 32));
guint contention_counter = allocator->contention_counters[ix];
gsize chunk_size = SLAB_CHUNK_SIZE (local_allocator, ix);
guint threshold = MAX (MIN_MAGAZINE_SIZE, local_allocator->max_page_size / MAX (5 * chunk_size, 5 * 32));
guint contention_counter = local_allocator->contention_counters[ix];
if (G_UNLIKELY (contention_counter)) /* single CPU bias */
{
/* adapt contention counter thresholds to chunk sizes */
@ -676,16 +676,16 @@ magazine_chain_prepare_fields (ChunkLink *magazine_chunks)
#define magazine_chain_count(mc) ((mc)->next->next->next->data)
static void
magazine_cache_trim (Allocator *allocator,
magazine_cache_trim (Allocator *local_allocator,
guint ix,
guint stamp)
{
/* g_mutex_lock (allocator->mutex); done by caller */
/* g_mutex_lock (local_allocator->mutex); done by caller */
/* trim magazine cache from tail */
ChunkLink *current = magazine_chain_prev (allocator->magazines[ix]);
ChunkLink *current = magazine_chain_prev (local_allocator->magazines[ix]);
ChunkLink *trash = NULL;
while (!G_APPROX_VALUE(stamp, magazine_chain_uint_stamp (current),
allocator->config.working_set_msecs))
while (!G_APPROX_VALUE (stamp, magazine_chain_uint_stamp (current),
local_allocator->config.working_set_msecs))
{
/* unlink */
ChunkLink *prev = magazine_chain_prev (current);
@ -699,19 +699,19 @@ magazine_cache_trim (Allocator *allocator,
magazine_chain_prev (current) = trash;
trash = current;
/* fixup list head if required */
if (current == allocator->magazines[ix])
if (current == local_allocator->magazines[ix])
{
allocator->magazines[ix] = NULL;
local_allocator->magazines[ix] = NULL;
break;
}
current = prev;
}
g_mutex_unlock (&allocator->magazine_mutex);
g_mutex_unlock (&local_allocator->magazine_mutex);
/* free trash */
if (trash)
{
const gsize chunk_size = SLAB_CHUNK_SIZE (allocator, ix);
g_mutex_lock (&allocator->slab_mutex);
const gsize chunk_size = SLAB_CHUNK_SIZE (local_allocator, ix);
g_mutex_lock (&local_allocator->slab_mutex);
while (trash)
{
current = trash;
@ -723,7 +723,7 @@ magazine_cache_trim (Allocator *allocator,
slab_allocator_free_chunk (chunk_size, chunk);
}
}
g_mutex_unlock (&allocator->slab_mutex);
g_mutex_unlock (&local_allocator->slab_mutex);
}
}
@ -1282,38 +1282,38 @@ g_slice_free_chain_with_offset (gsize mem_size,
/* --- single page allocator --- */
static void
allocator_slab_stack_push (Allocator *allocator,
allocator_slab_stack_push (Allocator *local_allocator,
guint ix,
SlabInfo *sinfo)
{
/* insert slab at slab ring head */
if (!allocator->slab_stack[ix])
if (!local_allocator->slab_stack[ix])
{
sinfo->next = sinfo;
sinfo->prev = sinfo;
}
else
{
SlabInfo *next = allocator->slab_stack[ix], *prev = next->prev;
SlabInfo *next = local_allocator->slab_stack[ix], *prev = next->prev;
next->prev = sinfo;
prev->next = sinfo;
sinfo->next = next;
sinfo->prev = prev;
}
allocator->slab_stack[ix] = sinfo;
local_allocator->slab_stack[ix] = sinfo;
}
static gsize
allocator_aligned_page_size (Allocator *allocator,
allocator_aligned_page_size (Allocator *local_allocator,
gsize n_bytes)
{
gsize val = (gsize) 1 << g_bit_storage (n_bytes - 1);
val = MAX (val, allocator->min_page_size);
val = MAX (val, local_allocator->min_page_size);
return val;
}
static void
allocator_add_slab (Allocator *allocator,
allocator_add_slab (Allocator *local_allocator,
guint ix,
gsize chunk_size)
{
@ -1326,7 +1326,7 @@ allocator_add_slab (Allocator *allocator,
guint8 *mem;
guint i;
page_size = allocator_aligned_page_size (allocator, SLAB_BPAGE_SIZE (allocator, chunk_size));
page_size = allocator_aligned_page_size (local_allocator, SLAB_BPAGE_SIZE (local_allocator, chunk_size));
/* allocate 1 page for the chunks and the slab */
aligned_memory = allocator_memalign (page_size, page_size - NATIVE_MALLOC_PADDING);
errsv = errno;
@ -1351,8 +1351,8 @@ allocator_add_slab (Allocator *allocator,
padding = ((guint8*) sinfo - mem) - n_chunks * chunk_size;
if (padding)
{
color = (allocator->color_accu * P2ALIGNMENT) % padding;
allocator->color_accu += allocator->config.color_increment;
color = (local_allocator->color_accu * P2ALIGNMENT) % padding;
local_allocator->color_accu += local_allocator->config.color_increment;
}
/* add chunks to free list */
chunk = (ChunkLink*) (mem + color);
@ -1364,7 +1364,7 @@ allocator_add_slab (Allocator *allocator,
}
chunk->next = NULL; /* last chunk */
/* add slab to slab ring */
allocator_slab_stack_push (allocator, ix, sinfo);
allocator_slab_stack_push (local_allocator, ix, sinfo);
}
static gpointer

View File

@ -978,7 +978,7 @@ g_spawn_sync (const gchar *working_directory,
gint reportpipe = -1;
GIOChannel *outchannel = NULL;
GIOChannel *errchannel = NULL;
GPollFD outfd, errfd;
GPollFD outfd = { -1, 0, 0 }, errfd = { -1, 0, 0 };
GPollFD fds[2];
gint nfds;
gint outindex = -1;

View File

@ -931,7 +931,7 @@ rules_from_windows_time_zone (const gchar *identifier,
TIME_ZONE_INFORMATION tzi;
DWORD size;
guint rules_num = 0;
RegTZI regtzi, regtzi_prev;
RegTZI regtzi = { 0 }, regtzi_prev;
WCHAR winsyspath[MAX_PATH];
gunichar2 *subkey_w, *subkey_dynamic_w;
@ -1127,7 +1127,7 @@ find_relative_date (TimeZoneDate *buffer)
g_date_set_dmy (&date, 1, buffer->mon, buffer->year);
first_wday = g_date_get_weekday (&date);
if (first_wday > wday)
if ((guint) first_wday > wday)
++(buffer->week);
/* week is 1 <= w <= 5, we need 0-based */
days = 7 * (buffer->week - 1) + wday - first_wday;

View File

@ -415,7 +415,7 @@ g_utf8_collate_key (const gchar *str,
return result;
#else
gsize xfrm_len;
gsize xfrm_len = 0;
const gchar *charset;
gchar *str_norm;