forked from ariadne/pkgconf
libpkgconf: fragment: pkgconf_fragment_parse: return false on parse failure
parent
72cf871421
commit
7ced8d77ae
|
@ -90,7 +90,7 @@ which is composable, mergeable and reorderable.
|
||||||
:param pkgconf_list_t* list: The `fragment list` to delete.
|
:param pkgconf_list_t* list: The `fragment list` to delete.
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: void pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value)
|
.. c:function:: bool pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value)
|
||||||
|
|
||||||
Parse a string into a `fragment list`.
|
Parse a string into a `fragment list`.
|
||||||
|
|
||||||
|
@ -98,4 +98,4 @@ which is composable, mergeable and reorderable.
|
||||||
:param pkgconf_list_t* list: The `fragment list` to add the fragment entries to.
|
:param pkgconf_list_t* list: The `fragment list` to add the fragment entries to.
|
||||||
:param pkgconf_list_t* vars: A list of variables to use for variable substitution.
|
:param pkgconf_list_t* vars: A list of variables to use for variable substitution.
|
||||||
:param char* value: The string to parse into fragments.
|
:param char* value: The string to parse into fragments.
|
||||||
:return: nothing
|
:return: true on success, false on parse error
|
||||||
|
|
|
@ -600,7 +600,7 @@ pkgconf_fragment_free(pkgconf_list_t *list)
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
* .. c:function:: void pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value)
|
* .. c:function:: bool pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value)
|
||||||
*
|
*
|
||||||
* Parse a string into a `fragment list`.
|
* Parse a string into a `fragment list`.
|
||||||
*
|
*
|
||||||
|
@ -608,9 +608,9 @@ pkgconf_fragment_free(pkgconf_list_t *list)
|
||||||
* :param pkgconf_list_t* list: The `fragment list` to add the fragment entries to.
|
* :param pkgconf_list_t* list: The `fragment list` to add the fragment entries to.
|
||||||
* :param pkgconf_list_t* vars: A list of variables to use for variable substitution.
|
* :param pkgconf_list_t* vars: A list of variables to use for variable substitution.
|
||||||
* :param char* value: The string to parse into fragments.
|
* :param char* value: The string to parse into fragments.
|
||||||
* :return: nothing
|
* :return: true on success, false on parse error
|
||||||
*/
|
*/
|
||||||
void
|
bool
|
||||||
pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value)
|
pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value)
|
||||||
{
|
{
|
||||||
int i, ret, argc;
|
int i, ret, argc;
|
||||||
|
@ -622,12 +622,24 @@ pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkg
|
||||||
{
|
{
|
||||||
PKGCONF_TRACE(client, "unable to parse fragment string [%s]", repstr);
|
PKGCONF_TRACE(client, "unable to parse fragment string [%s]", repstr);
|
||||||
free(repstr);
|
free(repstr);
|
||||||
return;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
{
|
||||||
|
if (argv[i] == NULL)
|
||||||
|
{
|
||||||
|
PKGCONF_TRACE(client, "parsed fragment string is inconsistent: argc = %d while argv[%d] == NULL", argc, i);
|
||||||
|
pkgconf_argv_free(argv);
|
||||||
|
free(repstr);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < argc && argv[i] != NULL; i++)
|
|
||||||
pkgconf_fragment_add(client, list, argv[i]);
|
pkgconf_fragment_add(client, list, argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
pkgconf_argv_free(argv);
|
pkgconf_argv_free(argv);
|
||||||
free(repstr);
|
free(repstr);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,7 @@ PKGCONF_API void pkgconf_argv_free(char **argv);
|
||||||
|
|
||||||
/* fragment.c */
|
/* fragment.c */
|
||||||
typedef bool (*pkgconf_fragment_filter_func_t)(const pkgconf_client_t *client, const pkgconf_fragment_t *frag, void *data);
|
typedef bool (*pkgconf_fragment_filter_func_t)(const pkgconf_client_t *client, const pkgconf_fragment_t *frag, void *data);
|
||||||
PKGCONF_API void pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value);
|
PKGCONF_API bool pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value);
|
||||||
PKGCONF_API void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string);
|
PKGCONF_API void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string);
|
||||||
PKGCONF_API void pkgconf_fragment_copy(const pkgconf_client_t *client, pkgconf_list_t *list, const pkgconf_fragment_t *base, bool is_private);
|
PKGCONF_API void pkgconf_fragment_copy(const pkgconf_client_t *client, pkgconf_list_t *list, const pkgconf_fragment_t *base, bool is_private);
|
||||||
PKGCONF_API void pkgconf_fragment_delete(pkgconf_list_t *list, pkgconf_fragment_t *node);
|
PKGCONF_API void pkgconf_fragment_delete(pkgconf_list_t *list, pkgconf_fragment_t *node);
|
||||||
|
|
Loading…
Reference in New Issue