Remove unused function uri_create
[lttng-tools.git] / src / common / uri.c
index 58ffcbcd66de518c8fba4ee4c470609af5ec8491..c735e856f3b12787106b86b0c4b184c5f075057c 100644 (file)
@@ -61,7 +61,7 @@ static const struct uri_proto proto_uri[] = {
  * Return pointer to the character in s matching one of the characters in
  * accept. If nothing is found, return pointer to the end of string (eos).
  */
-static const inline char *strpbrk_or_eos(const char *s, const char *accept)
+static inline const char *strpbrk_or_eos(const char *s, const char *accept)
 {
        char *p = strpbrk(s, accept);
        if (p == NULL) {
@@ -266,22 +266,6 @@ void uri_free(struct lttng_uri *uri)
        free(uri);
 }
 
-/*
- * Return an allocated URI.
- */
-LTTNG_HIDDEN
-struct lttng_uri *uri_create(void)
-{
-       struct lttng_uri *uri;
-
-       uri = zmalloc(sizeof(struct lttng_uri));
-       if (uri == NULL) {
-               PERROR("zmalloc uri");
-       }
-
-       return uri;
-}
-
 /*
  * Parses a string URI to a lttng_uri. This function can potentially return
  * more than one URI in uris so the size of the array is returned and uris is
@@ -587,6 +571,10 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
                if (ret < 0) {
                        PERROR("snprintf file url");
                        goto parse_error;
+               } else if (ret >= sizeof(url)) {
+                       PERROR("snprintf file url is too long");
+                       goto parse_error;
+
                }
                ctrl_url = url;
        }
@@ -604,7 +592,7 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
 
                if (ctrl_uris[0].dtype == LTTNG_DST_PATH &&
                                (data_url && *data_url != '\0')) {
-                       ERR("Can not have a data URL when destination is file://");
+                       ERR("Cannot have a data URL when destination is file://");
                        goto error;
                }
 
@@ -640,10 +628,12 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
 
                set_default_uri_attr(&data_uris[0], LTTNG_STREAM_DATA);
 
-               ret = compare_destination(&ctrl_uris[0], &data_uris[0]);
-               if (ret != 0) {
-                       ERR("Control and data destination mismatch");
-                       goto error;
+               if (ctrl_uris) {
+                       ret = compare_destination(&ctrl_uris[0], &data_uris[0]);
+                       if (ret != 0) {
+                               ERR("Control and data destination mismatch");
+                               goto error;
+                       }
                }
        }
 
This page took 0.024923 seconds and 4 git commands to generate.