uri: rename absolute & relative uri_string to uri_ref

Let's reserve the term URI for absolute URIs, following rfc3986
terminology.

See:
https://gitlab.gnome.org/GNOME/glib/-/issues/2169

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2020-07-28 15:07:03 +04:00
parent d625a29b28
commit 44d4640c47
2 changed files with 43 additions and 43 deletions

View File

@ -837,8 +837,8 @@ g_uri_split_internal (const gchar *uri_string,
/** /**
* g_uri_split: * g_uri_split:
* @uri_string: a string containing a relative or absolute URI * @uri_ref: a string containing a relative or absolute URI
* @flags: flags for parsing @uri_string * @flags: flags for parsing @uri_ref
* @scheme: (out) (nullable) (optional) (transfer full): on return, contains * @scheme: (out) (nullable) (optional) (transfer full): on return, contains
* the scheme (converted to lowercase), or %NULL * the scheme (converted to lowercase), or %NULL
* @userinfo: (out) (nullable) (optional) (transfer full): on return, contains * @userinfo: (out) (nullable) (optional) (transfer full): on return, contains
@ -855,14 +855,14 @@ g_uri_split_internal (const gchar *uri_string,
* the fragment, or %NULL * the fragment, or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Parses @uri_string (which can be an absolute or relative URI) * Parses @uri_ref (which can be an absolute or relative URI)
* according to @flags, and returns the pieces. Any component that * according to @flags, and returns the pieces. Any component that
* doesn't appear in @uri_string will be returned as %NULL (but note * doesn't appear in @uri_ref will be returned as %NULL (but note
* that all URIs always have a path component, though it may be the * that all URIs always have a path component, though it may be the
* empty string). * empty string).
* *
* If @flags contains %G_URI_FLAGS_ENCODED, then `%`-encoded characters in * If @flags contains %G_URI_FLAGS_ENCODED, then `%`-encoded characters in
* @uri_string will remain encoded in the output strings. (If not, * @uri_ref will remain encoded in the output strings. (If not,
* then all such characters will be decoded.) Note that decoding will * then all such characters will be decoded.) Note that decoding will
* only work if the URI components are ASCII or UTF-8, so you will * only work if the URI components are ASCII or UTF-8, so you will
* need to use %G_URI_FLAGS_ENCODED if they are not. * need to use %G_URI_FLAGS_ENCODED if they are not.
@ -872,13 +872,13 @@ g_uri_split_internal (const gchar *uri_string,
* since it always returns only the full userinfo; use * since it always returns only the full userinfo; use
* g_uri_split_with_user() if you want it split up. * g_uri_split_with_user() if you want it split up.
* *
* Returns: (skip): %TRUE if @uri_string parsed successfully, %FALSE * Returns: (skip): %TRUE if @uri_ref parsed successfully, %FALSE
* on error. * on error.
* *
* Since: 2.66 * Since: 2.66
*/ */
gboolean gboolean
g_uri_split (const gchar *uri_string, g_uri_split (const gchar *uri_ref,
GUriFlags flags, GUriFlags flags,
gchar **scheme, gchar **scheme,
gchar **userinfo, gchar **userinfo,
@ -889,10 +889,10 @@ g_uri_split (const gchar *uri_string,
gchar **fragment, gchar **fragment,
GError **error) GError **error)
{ {
g_return_val_if_fail (uri_string != NULL, FALSE); g_return_val_if_fail (uri_ref != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return g_uri_split_internal (uri_string, flags, return g_uri_split_internal (uri_ref, flags,
scheme, userinfo, NULL, NULL, NULL, scheme, userinfo, NULL, NULL, NULL,
host, port, path, query, fragment, host, port, path, query, fragment,
error); error);
@ -900,8 +900,8 @@ g_uri_split (const gchar *uri_string,
/** /**
* g_uri_split_with_user: * g_uri_split_with_user:
* @uri_string: a string containing a relative or absolute URI * @uri_ref: a string containing a relative or absolute URI
* @flags: flags for parsing @uri_string * @flags: flags for parsing @uri_ref
* @scheme: (out) (nullable) (optional) (transfer full): on return, contains * @scheme: (out) (nullable) (optional) (transfer full): on return, contains
* the scheme (converted to lowercase), or %NULL * the scheme (converted to lowercase), or %NULL
* @user: (out) (nullable) (optional) (transfer full): on return, contains * @user: (out) (nullable) (optional) (transfer full): on return, contains
@ -922,9 +922,9 @@ g_uri_split (const gchar *uri_string,
* the fragment, or %NULL * the fragment, or %NULL
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Parses @uri_string (which can be an absolute or relative URI) * Parses @uri_ref (which can be an absolute or relative URI)
* according to @flags, and returns the pieces. Any component that * according to @flags, and returns the pieces. Any component that
* doesn't appear in @uri_string will be returned as %NULL (but note * doesn't appear in @uri_ref will be returned as %NULL (but note
* that all URIs always have a path component, though it may be the * that all URIs always have a path component, though it may be the
* empty string). * empty string).
* *
@ -934,13 +934,13 @@ g_uri_split (const gchar *uri_string,
* @auth_params will only be parsed out if @flags contains * @auth_params will only be parsed out if @flags contains
* %G_URI_FLAGS_HAS_AUTH_PARAMS. * %G_URI_FLAGS_HAS_AUTH_PARAMS.
* *
* Returns: (skip): %TRUE if @uri_string parsed successfully, %FALSE * Returns: (skip): %TRUE if @uri_ref parsed successfully, %FALSE
* on error. * on error.
* *
* Since: 2.66 * Since: 2.66
*/ */
gboolean gboolean
g_uri_split_with_user (const gchar *uri_string, g_uri_split_with_user (const gchar *uri_ref,
GUriFlags flags, GUriFlags flags,
gchar **scheme, gchar **scheme,
gchar **user, gchar **user,
@ -953,10 +953,10 @@ g_uri_split_with_user (const gchar *uri_string,
gchar **fragment, gchar **fragment,
GError **error) GError **error)
{ {
g_return_val_if_fail (uri_string != NULL, FALSE); g_return_val_if_fail (uri_ref != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return g_uri_split_internal (uri_string, flags, return g_uri_split_internal (uri_ref, flags,
scheme, NULL, user, password, auth_params, scheme, NULL, user, password, auth_params,
host, port, path, query, fragment, host, port, path, query, fragment,
error); error);
@ -1039,29 +1039,29 @@ g_uri_split_network (const gchar *uri_string,
/** /**
* g_uri_is_valid: * g_uri_is_valid:
* @uri_string: a string containing a relative or absolute URI * @uri_ref: a string containing a relative or absolute URI
* @flags: flags for parsing @uri_string * @flags: flags for parsing @uri_ref
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Parses @uri_string (which can be an absolute or relative URI) * Parses @uri_ref (which can be an absolute or relative URI)
* according to @flags, to determine whether it is valid. * according to @flags, to determine whether it is valid.
* *
* See g_uri_split(), and the definition of #GUriFlags, for more * See g_uri_split(), and the definition of #GUriFlags, for more
* information on the effect of @flags. * information on the effect of @flags.
* *
* Returns: %TRUE if @uri_string parsed successfully, %FALSE on error. * Returns: %TRUE if @uri_ref parsed successfully, %FALSE on error.
* *
* Since: 2.66 * Since: 2.66
*/ */
gboolean gboolean
g_uri_is_valid (const gchar *uri_string, g_uri_is_valid (const gchar *uri_ref,
GUriFlags flags, GUriFlags flags,
GError **error) GError **error)
{ {
g_return_val_if_fail (uri_string != NULL, FALSE); g_return_val_if_fail (uri_ref != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return g_uri_split_internal (uri_string, flags, return g_uri_split_internal (uri_ref, flags,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
error); error);
@ -1157,11 +1157,11 @@ g_uri_parse (const gchar *uri_string,
/** /**
* g_uri_parse_relative: * g_uri_parse_relative:
* @base_uri: (nullable): a base absolute URI * @base_uri: (nullable): a base absolute URI
* @uri_string: a string representing a relative or absolute URI * @uri_ref: a string representing a relative or absolute URI
* @flags: flags describing how to parse @uri_string * @flags: flags describing how to parse @uri_ref
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Parses @uri_string according to @flags and, if it is a relative * Parses @uri_ref according to @flags and, if it is a relative
* URI, resolves it relative to @base_uri. If the result is not a * URI, resolves it relative to @base_uri. If the result is not a
* valid absolute URI, it will be discarded, and an error returned. * valid absolute URI, it will be discarded, and an error returned.
* *
@ -1171,13 +1171,13 @@ g_uri_parse (const gchar *uri_string,
*/ */
GUri * GUri *
g_uri_parse_relative (GUri *base_uri, g_uri_parse_relative (GUri *base_uri,
const gchar *uri_string, const gchar *uri_ref,
GUriFlags flags, GUriFlags flags,
GError **error) GError **error)
{ {
GUri *uri = NULL; GUri *uri = NULL;
g_return_val_if_fail (uri_string != NULL, NULL); g_return_val_if_fail (uri_ref != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL);
g_return_val_if_fail (base_uri == NULL || base_uri->scheme != NULL, NULL); g_return_val_if_fail (base_uri == NULL || base_uri->scheme != NULL, NULL);
@ -1186,7 +1186,7 @@ g_uri_parse_relative (GUri *base_uri,
uri = g_atomic_rc_box_new0 (GUri); uri = g_atomic_rc_box_new0 (GUri);
uri->flags = flags; uri->flags = flags;
if (!g_uri_split_internal (uri_string, flags, if (!g_uri_split_internal (uri_ref, flags,
&uri->scheme, &uri->userinfo, &uri->scheme, &uri->userinfo,
&uri->user, &uri->password, &uri->auth_params, &uri->user, &uri->password, &uri->auth_params,
&uri->host, &uri->port, &uri->host, &uri->port,
@ -1269,16 +1269,16 @@ g_uri_parse_relative (GUri *base_uri,
/** /**
* g_uri_resolve_relative: * g_uri_resolve_relative:
* @base_uri_string: (nullable): a string representing a base URI * @base_uri_string: (nullable): a string representing a base URI
* @uri_string: a string representing a relative or absolute URI * @uri_ref: a string representing a relative or absolute URI
* @flags: flags describing how to parse @uri_string * @flags: flags describing how to parse @uri_ref
* @error: #GError for error reporting, or %NULL to ignore. * @error: #GError for error reporting, or %NULL to ignore.
* *
* Parses @uri_string according to @flags and, if it is a relative * Parses @uri_ref according to @flags and, if it is a relative
* URI, resolves it relative to @base_uri_string. If the result is not * URI, resolves it relative to @base_uri_string. If the result is not
* a valid absolute URI, it will be discarded, and an error returned. * a valid absolute URI, it will be discarded, and an error returned.
* *
* (If @base_uri_string is %NULL, this just returns @uri_string, or * (If @base_uri_string is %NULL, this just returns @uri_ref, or
* %NULL if @uri_string is invalid or not absolute.) * %NULL if @uri_ref is invalid or not absolute.)
* *
* Return value: the resolved URI string. * Return value: the resolved URI string.
* *
@ -1286,14 +1286,14 @@ g_uri_parse_relative (GUri *base_uri,
*/ */
gchar * gchar *
g_uri_resolve_relative (const gchar *base_uri_string, g_uri_resolve_relative (const gchar *base_uri_string,
const gchar *uri_string, const gchar *uri_ref,
GUriFlags flags, GUriFlags flags,
GError **error) GError **error)
{ {
GUri *base_uri, *resolved_uri; GUri *base_uri, *resolved_uri;
gchar *resolved_uri_string; gchar *resolved_uri_string;
g_return_val_if_fail (uri_string != NULL, NULL); g_return_val_if_fail (uri_ref != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL);
flags |= G_URI_FLAGS_ENCODED; flags |= G_URI_FLAGS_ENCODED;
@ -1307,7 +1307,7 @@ g_uri_resolve_relative (const gchar *base_uri_string,
else else
base_uri = NULL; base_uri = NULL;
resolved_uri = g_uri_parse_relative (base_uri, uri_string, flags, error); resolved_uri = g_uri_parse_relative (base_uri, uri_ref, flags, error);
if (base_uri) if (base_uri)
g_uri_unref (base_uri); g_uri_unref (base_uri);
if (!resolved_uri) if (!resolved_uri)

View File

@ -78,7 +78,7 @@ typedef enum {
} GUriFlags; } GUriFlags;
GLIB_AVAILABLE_IN_2_66 GLIB_AVAILABLE_IN_2_66
gboolean g_uri_split (const gchar *uri_string, gboolean g_uri_split (const gchar *uri_ref,
GUriFlags flags, GUriFlags flags,
gchar **scheme, gchar **scheme,
gchar **userinfo, gchar **userinfo,
@ -89,7 +89,7 @@ gboolean g_uri_split (const gchar *uri_string,
gchar **fragment, gchar **fragment,
GError **error); GError **error);
GLIB_AVAILABLE_IN_2_66 GLIB_AVAILABLE_IN_2_66
gboolean g_uri_split_with_user (const gchar *uri_string, gboolean g_uri_split_with_user (const gchar *uri_ref,
GUriFlags flags, GUriFlags flags,
gchar **scheme, gchar **scheme,
gchar **user, gchar **user,
@ -110,7 +110,7 @@ gboolean g_uri_split_network (const gchar *uri_string,
GError **error); GError **error);
GLIB_AVAILABLE_IN_2_66 GLIB_AVAILABLE_IN_2_66
gboolean g_uri_is_valid (const gchar *uri_string, gboolean g_uri_is_valid (const gchar *uri_ref,
GUriFlags flags, GUriFlags flags,
GError **error); GError **error);
@ -141,13 +141,13 @@ GUri * g_uri_parse (const gchar *uri_string,
GError **error); GError **error);
GLIB_AVAILABLE_IN_2_66 GLIB_AVAILABLE_IN_2_66
GUri * g_uri_parse_relative (GUri *base_uri, GUri * g_uri_parse_relative (GUri *base_uri,
const gchar *uri_string, const gchar *uri_ref,
GUriFlags flags, GUriFlags flags,
GError **error); GError **error);
GLIB_AVAILABLE_IN_2_66 GLIB_AVAILABLE_IN_2_66
gchar * g_uri_resolve_relative (const gchar *base_uri_string, gchar * g_uri_resolve_relative (const gchar *base_uri_string,
const gchar *uri_string, const gchar *uri_ref,
GUriFlags flags, GUriFlags flags,
GError **error); GError **error);