Visibility hidden by default
[babeltrace.git] / src / common / uuid.c
index f6d895a8914c63d34f2a64de766cf9d86698f7bc..5c709f73e2eca890550b5f8666327323fbdad3bf 100644 (file)
@@ -1,23 +1,7 @@
 /*
- * Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
- *
- * 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:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ * SPDX-License-Identifier: MIT
  *
- * 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 <mjeanson@efficios.com>
  */
 
 #include <glib.h>
@@ -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,23 +50,21 @@ 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(uuid_in);
-       BT_ASSERT(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;
        bt_uuid_t uuid_scan;
 
-       BT_ASSERT(uuid_out);
-       BT_ASSERT(str_in);
+       BT_ASSERT_DBG(uuid_out);
+       BT_ASSERT_DBG(str_in);
 
        if (strnlen(str_in, BT_UUID_STR_LEN + 1) != BT_UUID_STR_LEN) {
                ret = -1;
@@ -100,19 +81,11 @@ end:
        return ret;
 }
 
-BT_HIDDEN
 int bt_uuid_compare(const bt_uuid_t uuid_a, const bt_uuid_t uuid_b)
 {
-       int ret = 0;
-
-       if (memcmp(uuid_a, uuid_b, BT_UUID_LEN) != 0) {
-               ret = -1;
-       }
-
-       return ret;
+       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);
This page took 0.039324 seconds and 4 git commands to generate.