]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
clang-format
authorEdgar Fuß <ef@math.uni-bonn.de>
Thu, 9 Jul 2020 10:54:48 +0000 (12:54 +0200)
committerGitHub <noreply@github.com>
Thu, 9 Jul 2020 10:54:48 +0000 (12:54 +0200)
Partly apply clang-format. Makes part of the code harder to read. Do not re-order sys/types.h.

src/irq.c

index 83fa0dd4e8e0e05fa31ebeff2f485523078afca2..3913e3b7ca3268a9d51c60ee7998a276b5f57e46 100644 (file)
--- a/src/irq.c
+++ b/src/irq.c
@@ -177,15 +177,9 @@ static int irq_read(void) {
 #endif /* KERNEL_LINUX */
 
 #if KERNEL_NETBSD
-static int
-irq_read (void)
-{
-  const int mib[4] = {
-    CTL_KERN,
-    KERN_EVCNT,
-    EVCNT_TYPE_INTR,
-    KERN_EVCNT_COUNT_NONZERO
-  };
+static int irq_read(void) {
+  const int mib[4] = {CTL_KERN, KERN_EVCNT, EVCNT_TYPE_INTR,
+                      KERN_EVCNT_COUNT_NONZERO};
   size_t buflen = 0;
   void *buf = NULL;
   const struct evcnt_sysctl *evs, *last_evs;
@@ -197,8 +191,7 @@ irq_read (void)
     newlen = buflen;
     if (buflen)
       buf = malloc(buflen);
-    error = sysctl(mib, __arraycount(mib),
-                   buf, &newlen, NULL, 0);
+    error = sysctl(mib, __arraycount(mib), buf, &newlen, NULL, 0);
     if (error) {
       ERROR("irq plugin: failed to get event count");
       return -1;
@@ -208,25 +201,23 @@ irq_read (void)
       break;
     }
     if (buf)
-            free(buf);
+      free(buf);
     buflen = newlen;
   }
   evs = buf;
-  last_evs = (void*)((char *)buf + buflen);
+  last_evs = (void *)((char *)buf + buflen);
   buflen /= sizeof(uint64_t);
-  while(evs < last_evs
-    && buflen > sizeof(*evs) / sizeof(uint64_t)
-    && buflen >= evs->ev_len)
-  {
+  while (evs < last_evs && buflen > sizeof(*evs) / sizeof(uint64_t) &&
+         buflen >= evs->ev_len) {
     char irqname[80];
 
     snprintf(irqname, 80, "%s-%s", evs->ev_strings,
-      evs->ev_strings + evs->ev_grouplen + 1);
+             evs->ev_strings + evs->ev_grouplen + 1);
 
     irq_submit(irqname, evs->ev_count);
 
     buflen -= evs->ev_len;
-    evs =(const void*)((const uint64_t *)evs + evs->ev_len);
+    evs = (const void *)((const uint64_t *)evs + evs->ev_len);
   }
   free(buf);
   return 0;