equal
deleted
inserted
replaced
28 #include <stdio.h> |
28 #include <stdio.h> |
29 #include <stdlib.h> |
29 #include <stdlib.h> |
30 #include <limits.h> |
30 #include <limits.h> |
31 #include <string.h> |
31 #include <string.h> |
32 |
32 |
33 static void flib_schemelist_destroy(flib_schemelist *list) { |
|
34 if(list) { |
|
35 for(int i=0; i<list->schemeCount; i++) { |
|
36 flib_scheme_release(list->schemes[i]); |
|
37 } |
|
38 free(list->schemes); |
|
39 free(list); |
|
40 } |
|
41 } |
|
42 |
|
43 static char *makePrefixedName(int schemeIndex, const char *settingName) { |
33 static char *makePrefixedName(int schemeIndex, const char *settingName) { |
44 return flib_asprintf("%i\\%s", schemeIndex, settingName); |
34 return flib_asprintf("%i\\%s", schemeIndex, settingName); |
45 } |
35 } |
46 |
36 |
47 static int readSettingsFromIni(flib_ini *ini, flib_scheme *scheme, int index) { |
37 static int readSettingsFromIni(flib_ini *ini, flib_scheme *scheme, int index) { |
181 } |
171 } |
182 return result; |
172 return result; |
183 } |
173 } |
184 |
174 |
185 flib_schemelist *flib_schemelist_create() { |
175 flib_schemelist *flib_schemelist_create() { |
186 return flib_schemelist_retain(flib_calloc(1, sizeof(flib_schemelist))); |
176 return flib_calloc(1, sizeof(flib_schemelist)); |
187 } |
177 } |
188 |
178 |
189 flib_schemelist *flib_schemelist_retain(flib_schemelist *list) { |
179 void flib_schemelist_destroy(flib_schemelist *list) { |
190 if(list) { |
180 if(list) { |
191 flib_retain(&list->_referenceCount, "flib_schemelist"); |
181 for(int i=0; i<list->schemeCount; i++) { |
192 } |
182 flib_scheme_release(list->schemes[i]); |
193 return list; |
183 } |
194 } |
184 free(list->schemes); |
195 |
185 free(list); |
196 void flib_schemelist_release(flib_schemelist *list) { |
|
197 if(list && flib_release(&list->_referenceCount, "flib_schemelist")) { |
|
198 flib_schemelist_destroy(list); |
|
199 } |
186 } |
200 } |
187 } |
201 |
188 |
202 flib_scheme *flib_schemelist_find(flib_schemelist *list, const char *name) { |
189 flib_scheme *flib_schemelist_find(flib_schemelist *list, const char *name) { |
203 if(!log_badargs_if2(list==NULL, name==NULL)) { |
190 if(!log_badargs_if2(list==NULL, name==NULL)) { |