- char **emails;
- size_t emails_length;
- unsigned int i;
-
- if (config->user_other_email == NULL) {
- emails = g_key_file_get_string_list (config->key_file,
- "user", "other_email",
- &emails_length, NULL);
- if (emails) {
- config->user_other_email = talloc_size (config,
- sizeof (char *) *
- (emails_length + 1));
- for (i = 0; i < emails_length; i++)
- config->user_other_email[i] = talloc_strdup (config->user_other_email,
- emails[i]);
- config->user_other_email[i] = NULL;
-
- g_strfreev (emails);
-
- config->user_other_email_length = emails_length;
+ assert(outlist);
+
+ if (*outlist == NULL) {
+
+ char **inlist = g_key_file_get_string_list (config->key_file,
+ section, key, list_length, NULL);
+ if (inlist) {
+ unsigned int i;
+
+ *outlist = talloc_size (config, sizeof (char *) * (*list_length + 1));
+
+ for (i = 0; i < *list_length; i++)
+ (*outlist)[i] = talloc_strdup (*outlist, inlist[i]);
+
+ (*outlist)[i] = NULL;
+
+ g_strfreev (inlist);