mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
GDBusMessage: add some G_UNLIKELY on error paths
More for documentation than anything else...
This commit is contained in:
parent
636cd00c21
commit
5d0e295fb8
@ -1346,7 +1346,7 @@ read_string (GMemoryBuffer *mbuf,
|
||||
gchar *str;
|
||||
const gchar *end_valid;
|
||||
|
||||
if (mbuf->pos + len >= mbuf->valid_len || mbuf->pos + len < mbuf->pos)
|
||||
if G_UNLIKELY (mbuf->pos + len >= mbuf->valid_len || mbuf->pos + len < mbuf->pos)
|
||||
{
|
||||
mbuf->pos = mbuf->valid_len;
|
||||
/* G_GSIZE_FORMAT doesn't work with gettext, so we use %lu */
|
||||
@ -1362,7 +1362,7 @@ read_string (GMemoryBuffer *mbuf,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mbuf->data[mbuf->pos + len] != '\0')
|
||||
if G_UNLIKELY (mbuf->data[mbuf->pos + len] != '\0')
|
||||
{
|
||||
str = g_strndup (mbuf->data + mbuf->pos, len);
|
||||
g_set_error (error,
|
||||
@ -1378,7 +1378,7 @@ read_string (GMemoryBuffer *mbuf,
|
||||
str = mbuf->data + mbuf->pos;
|
||||
mbuf->pos += len + 1;
|
||||
|
||||
if (!g_utf8_validate (str, -1, &end_valid))
|
||||
if G_UNLIKELY (!g_utf8_validate (str, -1, &end_valid))
|
||||
{
|
||||
gint offset;
|
||||
gchar *valid_str;
|
||||
@ -1406,7 +1406,7 @@ read_bytes (GMemoryBuffer *mbuf,
|
||||
{
|
||||
gconstpointer result;
|
||||
|
||||
if (mbuf->pos + len > mbuf->valid_len || mbuf->pos + len < mbuf->pos)
|
||||
if G_UNLIKELY (mbuf->pos + len > mbuf->valid_len || mbuf->pos + len < mbuf->pos)
|
||||
{
|
||||
mbuf->pos = mbuf->valid_len;
|
||||
/* G_GSIZE_FORMAT doesn't work with gettext, so we use %lu */
|
||||
|
Loading…
Reference in New Issue
Block a user