summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-message.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2004-11-13 07:07:47 +0000
committerHavoc Pennington <hp@redhat.com>2004-11-13 07:07:47 +0000
commit1b1dfafc344ad7b60b8156a1bbdbfc1b364bfa98 (patch)
tree8876649d553dbae0d210340e614ab5ba3da1cf87 /dbus/dbus-message.c
parentaa1294405e5440306a9d1ce1f6c4e86f8793e9b8 (diff)
2004-11-13 Havoc Pennington <hp@redhat.com>
* test/glib/test-profile.c: fix this thing up a bit * dbus/dbus-message.c (dbus_message_new_empty_header): increase preallocation sizes by a fair bit; not sure if this will be an overall performance win or not, but it does reduce reallocs. * dbus/dbus-string.c (set_length, reallocate_for_length): ignore the test hack that forced constant realloc if asserts are disabled, so we can profile sanely. Sprinkle in some _DBUS_UNLIKELY() which are probably pointless, but before I noticed the real performance problem I put them in. (_dbus_string_validate_utf8): micro-optimize this thing a little bit, though callgrind says it didn't help; then special-case ascii, which did help a lot; then be sure we detect nul bytes as invalid, which is a bugfix. (align_length_then_lengthen): add some more _DBUS_UNLIKELY superstition; use memset to nul the padding instead of a manual loop. (_dbus_string_get_length): inline this as a macro; it showed up in the profile because it's used for loop tests and so forth
Diffstat (limited to 'dbus/dbus-message.c')
-rw-r--r--dbus/dbus-message.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index df0ade26..0b3b1bf2 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -493,11 +493,13 @@ get_type_alignment (int type)
case DBUS_TYPE_ARRAY:
_dbus_assert_not_reached ("passed an ARRAY type to get_type_alignment()");
+ alignment = 0; /* quiet gcc */
break;
case DBUS_TYPE_INVALID:
default:
_dbus_assert_not_reached ("passed an invalid or unknown type to get_type_alignment()");
+ alignment = 0; /* quiet gcc */
break;
}
@@ -1355,7 +1357,7 @@ dbus_message_new_empty_header (void)
++i;
}
- if (!_dbus_string_init_preallocated (&message->header, 64))
+ if (!_dbus_string_init_preallocated (&message->header, 256))
{
dbus_free (message);
return NULL;