X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Furi.c;h=0638aebd90026ea9b7378106927ec5d9796af704;hp=380e75dd33b4839b144181c35f341a2724ef0f4e;hb=2463b7879c00298daa79744cdaae82ac061a4ed8;hpb=16aa84a9d47e500a29ed06c929600aa2117a6e80 diff --git a/src/common/uri.c b/src/common/uri.c index 380e75dd3..0638aebd9 100644 --- a/src/common/uri.c +++ b/src/common/uri.c @@ -1,18 +1,8 @@ /* - * Copyright (C) 2012 - David Goulet + * Copyright (C) 2012 David Goulet * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License, version 2 only, as - * published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _LGPL_SOURCE @@ -61,7 +51,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) { @@ -136,7 +126,7 @@ static int set_ip_address(const char *addr, int af, char *dst, size_t size) * We choose to use the system name resolution API first * to honor its network configuration. If this fails, we * resolve to the appropriate loopback address. This is - * done to accomodate systems which may want to start + * done to accommodates systems which may want to start * tracing before their network configured. */ const char *loopback_addr = af == AF_INET ? @@ -266,22 +256,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 @@ -608,7 +582,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; } @@ -644,10 +618,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; + } } }