提交 fd2a9dda 编写于 作者: D Daniel P. Berrangé

util: add helper API for getting URI parameters

Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 dee2218b
......@@ -3334,6 +3334,7 @@ virTypedParamsValidate;
virURIFormat;
virURIFormatParams;
virURIFree;
virURIGetParam;
virURIParse;
virURIResolveAlias;
......
......@@ -376,3 +376,19 @@ virURIResolveAlias(virConfPtr conf, const char *alias, char **uri)
return ret;
}
const char *
virURIGetParam(virURIPtr uri, const char *name)
{
size_t i;
for (i = 0; i < uri->paramsCount; i++) {
if (STREQ(uri->params[i].name, name))
return uri->params[i].value;
}
virReportError(VIR_ERR_INVALID_ARG,
_("Missing URI parameter '%s'"), name);
return NULL;
}
......@@ -62,4 +62,6 @@ void virURIFree(virURIPtr uri);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virURI, virURIFree);
int virURIResolveAlias(virConfPtr conf, const char *alias, char **uri);
const char *virURIGetParam(virURIPtr uri, const char *name);
#define VIR_URI_SERVER(uri) ((uri) && (uri)->server ? (uri)->server : "localhost")
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册