# HG changeset patch # User Medo # Date 1344285062 -7200 # Node ID 859ab685985463e6629171645014a6e5bc0ed4d9 # Parent 38acbfdb484fdec8279e38f517ce96c4013cb868 frontlib: Removed reference counting from schemelist diff -r 38acbfdb484f -r 859ab6859854 project_files/frontlib/model/schemelist.c --- a/project_files/frontlib/model/schemelist.c Thu Aug 02 16:36:11 2012 +0200 +++ b/project_files/frontlib/model/schemelist.c Mon Aug 06 22:31:02 2012 +0200 @@ -30,16 +30,6 @@ #include #include -static void flib_schemelist_destroy(flib_schemelist *list) { - if(list) { - for(int i=0; ischemeCount; i++) { - flib_scheme_release(list->schemes[i]); - } - free(list->schemes); - free(list); - } -} - static char *makePrefixedName(int schemeIndex, const char *settingName) { return flib_asprintf("%i\\%s", schemeIndex, settingName); } @@ -183,19 +173,16 @@ } flib_schemelist *flib_schemelist_create() { - return flib_schemelist_retain(flib_calloc(1, sizeof(flib_schemelist))); + return flib_calloc(1, sizeof(flib_schemelist)); } -flib_schemelist *flib_schemelist_retain(flib_schemelist *list) { +void flib_schemelist_destroy(flib_schemelist *list) { if(list) { - flib_retain(&list->_referenceCount, "flib_schemelist"); - } - return list; -} - -void flib_schemelist_release(flib_schemelist *list) { - if(list && flib_release(&list->_referenceCount, "flib_schemelist")) { - flib_schemelist_destroy(list); + for(int i=0; ischemeCount; i++) { + flib_scheme_release(list->schemes[i]); + } + free(list->schemes); + free(list); } } diff -r 38acbfdb484f -r 859ab6859854 project_files/frontlib/model/schemelist.h --- a/project_files/frontlib/model/schemelist.h Thu Aug 02 16:36:11 2012 +0200 +++ b/project_files/frontlib/model/schemelist.h Mon Aug 06 22:31:02 2012 +0200 @@ -29,7 +29,6 @@ #include "scheme.h" typedef struct { - int _referenceCount; int schemeCount; flib_scheme **schemes; } flib_schemelist; @@ -60,7 +59,7 @@ int flib_schemelist_insert(flib_schemelist *list, flib_scheme *cfg, int pos); /** - * Delete a cfg from the list at position pos, moving down all higher schemes. + * Delete a scheme from the list at position pos, moving down all higher schemes. * The scheme is released automatically. * Returns 0 on success. */ @@ -72,15 +71,9 @@ flib_scheme *flib_schemelist_find(flib_schemelist *list, const char *name); /** - * Increase the reference count of the object. Call this if you store a pointer to it somewhere. - * Returns the parameter. + * Free this schemelist. */ -flib_schemelist *flib_schemelist_retain(flib_schemelist *list); - -/** - * Decrease the reference count of the object and free it if this was the last reference. - */ -void flib_schemelist_release(flib_schemelist *list); +void flib_schemelist_destroy(flib_schemelist *list); #endif /* SCHEMELIST_H_ */