Clean-up: modernize pretty_xml.cpp
[lttng-tools.git] / tests / utils / utils.cpp
index fee74e961245d02e0322f70c86c9e7d21e33cd43..fbf0019cb713f43d08ced60a39553a9e770dce50 100644 (file)
@@ -5,8 +5,13 @@
  *
  */
 
-#include <common/compat/time.h>
-#include <common/time.h>
+#include "utils.h"
+
+#include <common/compat/errno.hpp>
+#include <common/compat/time.hpp>
+#include <common/macros.hpp>
+#include <common/time.hpp>
+
 #include <fcntl.h>
 #include <poll.h>
 #include <stdbool.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <common/compat/errno.h>
-#include <common/macros.h>
-
-#include "utils.h"
-
-static inline
 int64_t elapsed_time_ns(struct timespec *t1, struct timespec *t2)
 {
        struct timespec delta;
@@ -30,8 +29,7 @@ int64_t elapsed_time_ns(struct timespec *t1, struct timespec *t2)
        LTTNG_ASSERT(t1 && t2);
        delta.tv_sec = t2->tv_sec - t1->tv_sec;
        delta.tv_nsec = t2->tv_nsec - t1->tv_nsec;
-       return ((int64_t) NSEC_PER_SEC * (int64_t) delta.tv_sec) +
-                       (int64_t) delta.tv_nsec;
+       return ((int64_t) NSEC_PER_SEC * (int64_t) delta.tv_sec) + (int64_t) delta.tv_nsec;
 }
 
 int usleep_safe(useconds_t usec)
@@ -101,24 +99,23 @@ int wait_on_file(const char *path)
        for (;;) {
                ret = stat(path, &buf);
                if (ret == -1 && errno == ENOENT) {
-                       ret = poll(NULL, 0, 10);        /* 10 ms delay */
+                       ret = poll(nullptr, 0, 10); /* 10 ms delay */
                        /* Should return 0 everytime */
                        if (ret) {
                                if (ret < 0) {
                                        perror("perror");
                                } else {
-                                       fprintf(stderr,
-                                               "poll return value is larger than zero\n");
+                                       fprintf(stderr, "poll return value is larger than zero\n");
                                }
                                return -1;
                        }
-                       continue;                       /* retry */
+                       continue; /* retry */
                }
                if (ret) {
                        perror("stat");
                        return -1;
                }
-               break;  /* found */
+               break; /* found */
        }
 
        return 0;
This page took 0.023528 seconds and 4 git commands to generate.