X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Ftracker.c;h=0fdbd60f9eaacce380478be6b3dc9b68e77b3944;hp=126f8252a7016e66dc7e210a2f5614c4dc87ef9c;hb=235493868254e943513c6552c6821236284f00ac;hpb=79408a2bac87e03a9dd9674e10c1ec83ec1060cf diff --git a/src/common/tracker.c b/src/common/tracker.c index 126f8252a..0fdbd60f9 100644 --- a/src/common/tracker.c +++ b/src/common/tracker.c @@ -1,18 +1,8 @@ /* - * Copyright (C) 2019 - Jonathan Rajotte-Julien + * Copyright (C) 2019 Jonathan Rajotte-Julien * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License, version 2.1 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: LGPL-2.1-only * - * This library 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -294,11 +284,13 @@ end: void lttng_tracker_ids_destroy(struct lttng_tracker_ids *ids) { + int i; + if (!ids) { return; } - for (int i = 0; i < ids->count; i++) { + for (i = 0; i < ids->count; i++) { lttng_tracker_id_reset(&ids->id_array[i]); } free(ids->id_array); @@ -308,12 +300,13 @@ void lttng_tracker_ids_destroy(struct lttng_tracker_ids *ids) int lttng_tracker_ids_serialize(const struct lttng_tracker_ids *ids, struct lttng_dynamic_buffer *buffer) { - int ret; + int ret = 0; int value; const char *string; unsigned int count; enum lttng_tracker_id_status status; const struct lttng_tracker_id *id; + unsigned int i; status = lttng_tracker_ids_get_count(ids, &count); if (status != LTTNG_TRACKER_ID_STATUS_OK) { @@ -321,7 +314,7 @@ int lttng_tracker_ids_serialize(const struct lttng_tracker_ids *ids, goto error; } - for (unsigned int i = 0; i < count; i++) { + for (i = 0; i < count; i++) { struct lttcomm_tracker_id_header id_hdr; size_t var_data_len = 0;