Skip to content

Commit

Permalink
libotutil: Rename to ot_keyfile_get_string_list_with_separator_choice()
Browse files Browse the repository at this point in the history
Renames ot_keyfile_get_string_as_list() to
ot_keyfile_get_string_list_with_separator_choice() which expresses
more clerly why the function is needed. Also shorten the
function comment.
  • Loading branch information
Robert Fairley authored and rfairley committed Feb 20, 2019
1 parent aa02b9a commit 3a6f8a0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
8 changes: 6 additions & 2 deletions src/libostree/ostree-repo.c
Original file line number Diff line number Diff line change
Expand Up @@ -5186,8 +5186,12 @@ _ostree_repo_gpg_verify_data_internal (OstreeRepo *self,

g_auto(GStrv) gpgkeypath_list = NULL;

if (!ot_keyfile_get_string_as_list (remote->options, remote->group, "gpgkeypath",
";,", &gpgkeypath_list, error))
if (!ot_keyfile_get_string_list_with_separator_choice (remote->options,
remote->group,
"gpgkeypath",
";,",
&gpgkeypath_list,
error))
return NULL;

if (gpgkeypath_list)
Expand Down
23 changes: 11 additions & 12 deletions src/libotutil/ot-keyfile-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,19 @@ ot_keyfile_get_value_with_default (GKeyFile *keyfile,
return ret;
}

/* Read the value of key as a string. If the value string contains
* one of the separators and none of the others, read the
* string as a NULL-terminated array out_value. If the value string contains
* none of the separators, read the string as a single entry into a
* NULL-terminated array out_value. If the value string contains multiple of
* the separators, an error is given.
/* Read the value of key as a string. If the value string contains
* zero or one of the separators and none of the others, read the
* string as a NULL-terminated array out_value. If the value string
* contains multiple of the separators, give an error.
*
* Returns TRUE on success, FALSE on error. */
gboolean
ot_keyfile_get_string_as_list (GKeyFile *keyfile,
const char *section,
const char *key,
const char *separators,
char ***out_value,
GError **error)
ot_keyfile_get_string_list_with_separator_choice (GKeyFile *keyfile,
const char *section,
const char *key,
const char *separators,
char ***out_value,
GError **error)
{
guint sep_count = 0;
gchar sep = '\0';
Expand Down
12 changes: 6 additions & 6 deletions src/libotutil/ot-keyfile-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ ot_keyfile_get_value_with_default (GKeyFile *keyfile,
GError **error);

gboolean
ot_keyfile_get_string_as_list (GKeyFile *keyfile,
const char *section,
const char *key,
const char *separators,
char ***out_value_list,
GError **error);
ot_keyfile_get_string_list_with_separator_choice (GKeyFile *keyfile,
const char *section,
const char *key,
const char *separators,
char ***out_value_list,
GError **error);

gboolean
ot_keyfile_get_string_list_with_default (GKeyFile *keyfile,
Expand Down

0 comments on commit 3a6f8a0

Please sign in to comment.