mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Merge branch 'scan-build-fixes' into 'main'
Fix various scan-build warnings See merge request GNOME/glib!2628
This commit is contained in:
commit
4f48d4e1bb
@ -1651,14 +1651,12 @@ file_is_hidden (const gchar *path,
|
||||
if (!g_hash_table_lookup_extended (hidden_cache, dirname,
|
||||
NULL, (gpointer *) &data))
|
||||
{
|
||||
gchar *mydirname;
|
||||
|
||||
data = g_new0 (HiddenCacheData, 1);
|
||||
data->hidden_files = table = read_hidden_file (dirname);
|
||||
data->timestamp_secs = g_get_monotonic_time () / G_USEC_PER_SEC;
|
||||
|
||||
g_hash_table_insert (hidden_cache,
|
||||
mydirname = g_strdup (dirname),
|
||||
g_strdup (dirname),
|
||||
data);
|
||||
|
||||
if (!hidden_cache_source)
|
||||
|
@ -463,6 +463,8 @@ g_socket_details_from_fd (GSocket *socket)
|
||||
int value, family;
|
||||
int errsv;
|
||||
|
||||
memset (&address, 0, sizeof (address));
|
||||
|
||||
fd = socket->priv->fd;
|
||||
if (!g_socket_get_option (socket, SOL_SOCKET, SO_TYPE, &value, NULL))
|
||||
{
|
||||
|
@ -143,7 +143,6 @@ ensure_gdbus_testserver_up (GDBusConnection *connection,
|
||||
g_main_context_iteration (context, TRUE);
|
||||
|
||||
g_bus_unwatch_name (watch_id);
|
||||
watch_id = 0;
|
||||
|
||||
while (!data.unwatch_complete)
|
||||
g_main_context_iteration (context, TRUE);
|
||||
|
@ -2279,19 +2279,19 @@ g_date_time_get_day_of_month (GDateTime *datetime)
|
||||
{
|
||||
gint day_of_year,
|
||||
i;
|
||||
const guint16 *days;
|
||||
guint is_leap;
|
||||
guint16 last = 0;
|
||||
|
||||
g_return_val_if_fail (datetime != NULL, 0);
|
||||
|
||||
days = days_in_year[GREGORIAN_LEAP (g_date_time_get_year (datetime)) ? 1 : 0];
|
||||
is_leap = GREGORIAN_LEAP (g_date_time_get_year (datetime)) ? 1 : 0;
|
||||
g_date_time_get_week_number (datetime, NULL, NULL, &day_of_year);
|
||||
|
||||
for (i = 1; i <= 12; i++)
|
||||
{
|
||||
if (days [i] >= day_of_year)
|
||||
if (days_in_year[is_leap][i] >= day_of_year)
|
||||
return day_of_year - last;
|
||||
last = days [i];
|
||||
last = days_in_year[is_leap][i];
|
||||
}
|
||||
|
||||
g_warn_if_reached ();
|
||||
|
@ -4147,7 +4147,7 @@ g_main_context_iterate (GMainContext *context,
|
||||
gboolean dispatch,
|
||||
GThread *self)
|
||||
{
|
||||
gint max_priority;
|
||||
gint max_priority = 0;
|
||||
gint timeout;
|
||||
gboolean some_ready;
|
||||
gint nfds, allocated_nfds;
|
||||
|
@ -2238,6 +2238,7 @@ g_log_writer_is_journald (gint output_fd)
|
||||
/* Namespaced journals start with `/run/systemd/journal.${name}/` (see
|
||||
* `RuntimeDirectory=systemd/journal.%i` in `systemd-journald@.service`. The
|
||||
* default journal starts with `/run/systemd/journal/`. */
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
addr_len = sizeof(addr);
|
||||
err = getpeername (output_fd, &addr.sa, &addr_len);
|
||||
if (err == 0 && addr.storage.ss_family == AF_UNIX)
|
||||
|
@ -1856,6 +1856,7 @@ test_read_link (void)
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
|
||||
"*assertion*!= NULL*");
|
||||
newpath = g_file_read_link (NULL, &error);
|
||||
g_assert_null (newpath);
|
||||
g_test_assert_expected_messages ();
|
||||
}
|
||||
|
||||
|
@ -140,12 +140,11 @@ test_thread4 (void)
|
||||
struct rlimit ol, nl;
|
||||
GThread *thread;
|
||||
GError *error;
|
||||
gint ret;
|
||||
|
||||
getrlimit (RLIMIT_NPROC, &nl);
|
||||
nl.rlim_cur = 1;
|
||||
|
||||
if ((ret = prlimit (getpid (), RLIMIT_NPROC, &nl, &ol)) != 0)
|
||||
if (prlimit (getpid (), RLIMIT_NPROC, &nl, &ol) != 0)
|
||||
g_error ("prlimit failed: %s", g_strerror (errno));
|
||||
|
||||
error = NULL;
|
||||
@ -171,7 +170,7 @@ test_thread4 (void)
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
if ((ret = prlimit (getpid (), RLIMIT_NPROC, &ol, NULL)) != 0)
|
||||
if (prlimit (getpid (), RLIMIT_NPROC, &ol, NULL) != 0)
|
||||
g_error ("resetting RLIMIT_NPROC failed: %s", g_strerror (errno));
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user