X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=src%2Fcommon%2Fuuid.c;h=5c709f73e2eca890550b5f8666327323fbdad3bf;hb=5046c776430ff9f1c0580bad8cd36511fae636f8;hp=d59f750ca0bab0a2aabac414b7c9c462db30d4a5;hpb=98b15851a941e7342b8bb19e265cdc3a40fabfb8;p=babeltrace.git diff --git a/src/common/uuid.c b/src/common/uuid.c index d59f750c..5c709f73 100644 --- a/src/common/uuid.c +++ b/src/common/uuid.c @@ -1,23 +1,7 @@ /* - * Copyright (C) 2019 Michael Jeanson - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * SPDX-License-Identifier: MIT * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Copyright (C) 2019 Michael Jeanson */ #include @@ -32,7 +16,6 @@ /* * Generate a random UUID according to RFC4122, section 4.4. */ -BT_HIDDEN void bt_uuid_generate(bt_uuid_t uuid_out) { int i; @@ -67,16 +50,14 @@ void bt_uuid_generate(bt_uuid_t uuid_out) g_rand_free(rand); } -BT_HIDDEN void bt_uuid_to_str(const bt_uuid_t uuid_in, char *str_out) { BT_ASSERT_DBG(uuid_in); BT_ASSERT_DBG(str_out); - sprintf(str_out, BT_UUID_FMT, BT_UUID_FMT_VALUES(uuid_in)); + snprintf(str_out, BT_UUID_STR_LEN + 1, BT_UUID_FMT, BT_UUID_FMT_VALUES(uuid_in)); } -BT_HIDDEN int bt_uuid_from_str(const char *str_in, bt_uuid_t uuid_out) { int ret = 0; @@ -100,13 +81,11 @@ end: return ret; } -BT_HIDDEN int bt_uuid_compare(const bt_uuid_t uuid_a, const bt_uuid_t uuid_b) { return memcmp(uuid_a, uuid_b, BT_UUID_LEN); } -BT_HIDDEN void bt_uuid_copy(bt_uuid_t uuid_dest, const bt_uuid_t uuid_src) { BT_ASSERT(uuid_dest);