keyfile: avoid needless allocations on file load
authorJohn Lindgren <john.lindgren@tds.net>
Tue, 17 May 2011 02:27:11 +0000 (22:27 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 17 May 2011 03:36:39 +0000 (23:36 -0400)
commit9c1a44cf32ebeee00a0e2303832b9cea26c93b76
treeca973e36ee385025c82b83c8832d9ec2e3adc95b
parentf96dc555d5b56aa56ad1d77bb3fde685ca612e68
keyfile: avoid needless allocations on file load

When loading a key file, the keys and values of individual lines
are allocated once when copied and trimmed from the parse buffer
and allocated/copied again when added to the lookup map.

This commit avoids the second pair of allocations by introducing
a new function g_key_file_add_key_value_pair that gives the
lookup map direct ownership of the key and value copied from the
parse buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=650211
glib/gkeyfile.c