Move to kernel style SPDX license identifiers
[babeltrace.git] / tests / plugins / flt.lttng-utils.debug-info / test_dwarf.c
index abb72bba6051e516404fb16b6140a9ac4c97150a..b394a10f972aef65b8cb697f054b07f7ce94022c 100644 (file)
@@ -1,23 +1,10 @@
 /*
- * test_dwarf.c
+ * SPDX-License-Identifier: GPL-2.0-only
  *
- * Babeltrace bt_dwarf (DWARF utilities) tests
- *
- * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2015 Antoine Busque <abusque@efficios.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; under version 2 of the License.
- *
- * 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.
+ * Copyright (C) 2015 EfficiOS Inc. and Linux Foundation
+ * Copyright (C) 2015 Antoine Busque <abusque@efficios.com>
  *
- * 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.
+ * Babeltrace bt_dwarf (DWARF utilities) tests
  */
 
 #include <fcntl.h>
@@ -46,7 +33,7 @@ void test_bt_no_dwarf(const char *data_dir)
        Dwarf *dwarf_info = NULL;
 
        path = g_build_filename(data_dir, ELF_DIR_NAME, SO_NAME, NULL);
-       if (path == NULL) {
+       if (!path) {
                diag("Failed to allocate memory for path");
                exit(EXIT_FAILURE);
        }
@@ -57,13 +44,16 @@ void test_bt_no_dwarf(const char *data_dir)
                skip(1, "dwarf_begin failed as expected");
        } else {
                dwarf_info = dwarf_begin(fd, DWARF_C_READ);
-               ok(dwarf_info == NULL, "dwarf_begin failed as expected");
+               ok(!dwarf_info, "dwarf_begin failed as expected");
        }
 
-       if (dwarf_info != NULL) {
+       if (dwarf_info) {
                dwarf_end(dwarf_info);
        }
-       close(fd);
+
+       if (fd >= 0) {
+               close(fd);
+       }
        g_free(path);
 }
 
@@ -81,7 +71,7 @@ void test_bt_dwarf(const char *data_dir)
        Dwarf *dwarf_info = NULL;
 
        path = g_build_filename(data_dir, DWARF_DIR_NAME, SO_NAME, NULL);
-       if (path == NULL) {
+       if (!path) {
                diag("Failed to allocate memory for path");
                exit(EXIT_FAILURE);
        }
@@ -92,13 +82,13 @@ void test_bt_dwarf(const char *data_dir)
                exit(EXIT_FAILURE);
        }
        dwarf_info = dwarf_begin(fd, DWARF_C_READ);
-       ok(dwarf_info != NULL, "dwarf_begin successful");
+       ok(dwarf_info, "dwarf_begin successful");
        cu = bt_dwarf_cu_create(dwarf_info);
-       ok(cu != NULL, "bt_dwarf_cu_create successful");
+       ok(cu, "bt_dwarf_cu_create successful");
        ret = bt_dwarf_cu_next(cu);
        ok(ret == 0, "bt_dwarf_cu_next successful");
        die = bt_dwarf_die_create(cu);
-       ok(die != NULL, "bt_dwarf_die_create successful");
+       ok(die, "bt_dwarf_die_create successful");
        if (!die) {
                exit(EXIT_FAILURE);
        }
This page took 0.028707 seconds and 4 git commands to generate.