Force usage of assert() condition when NDEBUG is defined
[lttng-tools.git] / src / common / fd-handle.c
index a9c7be4a938ab86aa44d3c6316c3ccd8a04e6537..510e1181bd1193435a06b158e737d54c9051d53f 100644 (file)
@@ -21,7 +21,7 @@ static void fd_handle_release(struct urcu_ref *ref)
        int ret;
        struct fd_handle *handle = container_of(ref, struct fd_handle, ref);
 
-       assert(handle->fd >= 0);
+       LTTNG_ASSERT(handle->fd >= 0);
        ret = close(handle->fd);
        if (ret == -1) {
                PERROR("Failed to close file descriptor of fd_handle upon release: fd = %d",
@@ -58,21 +58,27 @@ end:
 LTTNG_HIDDEN
 void fd_handle_get(struct fd_handle *handle)
 {
-       assert(handle);
+       if (!handle) {
+               return;
+       }
+
        urcu_ref_get(&handle->ref);
 }
 
 LTTNG_HIDDEN
 void fd_handle_put(struct fd_handle *handle)
 {
-       assert(handle);
+       if (!handle) {
+               return;
+       }
+
        urcu_ref_put(&handle->ref, fd_handle_release);
 }
 
 LTTNG_HIDDEN
 int fd_handle_get_fd(struct fd_handle *handle)
 {
-       assert(handle);
+       LTTNG_ASSERT(handle);
        return handle->fd;
 }
 
This page took 0.030612 seconds and 4 git commands to generate.