! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Lazy init the hash table for named structures
Status:
RESOLVED: FIXED
Product:
Xfconf
Component:
Libxfconf

Comments

Description Nick Schermer editbugs 2008-08-07 20:11:15 CEST
Currently a hash table is created during xfconf_init(). I think this is not needed and a 'waste' of memory since most people will not use named structures. Better init the hash table when adding the first named structure.
Comment 1 Nick Schermer editbugs 2008-08-07 20:14:17 CEST
Created attachment 1759 
Lazy init the hash table.

* Lazy init the hash table inside xfconf_named_struct_register().
* Use slice allocator for the XfconfNamedStruct structure.
* Added usable warning when the struct is already in the table, could be replaced with a simple g_return_if_fail() after creating the table, but this is more to to point IMHO.
Comment 2 Nick Schermer editbugs 2008-08-07 20:16:33 CEST
Btw, haven't tested the code, but it looks safe to me...
Comment 3 Brian J. Tarricone (not reading bugmail) 2008-08-07 20:28:26 CEST
Looks fine to me too.  Go ahead and commit.
Comment 4 Nick Schermer editbugs 2008-08-07 20:40:08 CEST
Committed in revision 27429.

Bug #4267

Reported by:
Nick Schermer
Reported on: 2008-08-07
Last modified on: 2015-02-16

People

Assignee:
Brian J. Tarricone (not reading bugmail)
CC List:
0 users

Version

Version:
GIT Master

Attachments

Lazy init the hash table. (2.58 KB, patch)
2008-08-07 20:14 CEST , Nick Schermer
no flags

Additional information