mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 17:14:02 +00:00
ifcfg-rh: add svFindFirstKeyWithPrefix() function
This commit is contained in:
parent
bdd7d858f3
commit
e9d960740a
|
@ -891,6 +891,28 @@ svGetKeys (shvarFile *s)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
const char *
|
||||||
|
svFindFirstKeyWithPrefix (shvarFile *s, const char *key_prefix)
|
||||||
|
{
|
||||||
|
CList *current;
|
||||||
|
const shvarLine *l;
|
||||||
|
|
||||||
|
g_return_val_if_fail (s, NULL);
|
||||||
|
g_return_val_if_fail (key_prefix, NULL);
|
||||||
|
|
||||||
|
c_list_for_each (current, &s->lst_head) {
|
||||||
|
l = c_list_entry (current, shvarLine, lst);
|
||||||
|
if ( l->key
|
||||||
|
&& l->line
|
||||||
|
&& g_str_has_prefix (l->key, key_prefix))
|
||||||
|
return l->key;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
_svGetValue (shvarFile *s, const char *key, char **to_free)
|
_svGetValue (shvarFile *s, const char *key, char **to_free)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,6 +44,8 @@ shvarFile *svCreateFile (const char *name);
|
||||||
/* Open the file <name>, return shvarFile on success, NULL on failure */
|
/* Open the file <name>, return shvarFile on success, NULL on failure */
|
||||||
shvarFile *svOpenFile (const char *name, GError **error);
|
shvarFile *svOpenFile (const char *name, GError **error);
|
||||||
|
|
||||||
|
const char *svFindFirstKeyWithPrefix (shvarFile *s, const char *key_prefix);
|
||||||
|
|
||||||
/* Get the value associated with the key, and leave the current pointer
|
/* Get the value associated with the key, and leave the current pointer
|
||||||
* pointing at the line containing the value. The char* returned MUST
|
* pointing at the line containing the value. The char* returned MUST
|
||||||
* be freed by the caller.
|
* be freed by the caller.
|
||||||
|
|
Loading…
Reference in a new issue