summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-09-11 22:41:30 -0500
committerSamuel Holland <samuel@sholland.org>2018-09-11 22:50:44 -0500
commit9bc7c737b311fcbba71af11884b7f9111dba57ba (patch)
tree6ad80501db199c916e8fc2ed5648bf694a257675
parentd8e667a638401df1bf881b16fcda6315f3fa3eb1 (diff)
downloadgcompat-9bc7c737b311fcbba71af11884b7f9111dba57ba.tar.gz
gcompat-9bc7c737b311fcbba71af11884b7f9111dba57ba.tar.bz2
gcompat-9bc7c737b311fcbba71af11884b7f9111dba57ba.tar.xz
gcompat-9bc7c737b311fcbba71af11884b7f9111dba57ba.zip
libgcompat: Fix formatting inconsistencies (clang-format)
Signed-off-by: Samuel Holland <samuel@sholland.org>
-rw-r--r--libgcompat/gnulib.c16
-rw-r--r--libgcompat/internal.c3
-rw-r--r--libgcompat/math.c13
-rw-r--r--libgcompat/resolv.c2
-rw-r--r--libgcompat/socket.c2
-rw-r--r--libgcompat/string.c9
6 files changed, 21 insertions, 24 deletions
diff --git a/libgcompat/gnulib.c b/libgcompat/gnulib.c
index ccdec24..3f66963 100644
--- a/libgcompat/gnulib.c
+++ b/libgcompat/gnulib.c
@@ -1,16 +1,18 @@
#include <sys/select.h>
#include "internal.h"
-#define REASON_FD_SET_OVERFLOW \
- "Fault: Overflow in fd_set detected.\n" \
- "Description: This is caused by a programmer naively attempting to redefine FD_SETSIZE,\n" \
- " which is not allowed on POSIX platforms. The program must be either rebuilt\n" \
- " with the correct FD_SETSIZE definition, or preferably rewritten to avoid use\n" \
- " of select(2) in general. See also: poll(2).\n" \
+#define REASON_FD_SET_OVERFLOW \
+ "Fault: Overflow in fd_set detected.\n" \
+ "Description: This is caused by a programmer naively attempting to\n" \
+ " redefine FD_SETSIZE, which is not allowed on POSIX platforms.\n" \
+ " The program must either be rebuilt with the correct FD_SETSIZE\n" \
+ " definition, or else be rewritten to avoid use of select(2) in \n" \
+ " general. See also: poll(2).\n" \
" libgcompat believes FD_SETSIZE to be %zu.\n"
unsigned long __fdelt_chk(unsigned long size)
{
- GCOMPAT__assert_with_reason(size < FD_SETSIZE, REASON_FD_SET_OVERFLOW, FD_SETSIZE);
+ GCOMPAT__assert_with_reason(size < FD_SETSIZE, REASON_FD_SET_OVERFLOW,
+ FD_SETSIZE);
return size / (sizeof(unsigned long) << 3);
}
diff --git a/libgcompat/internal.c b/libgcompat/internal.c
index 441b3cc..450c5e4 100644
--- a/libgcompat/internal.c
+++ b/libgcompat/internal.c
@@ -1,8 +1,7 @@
-#include <stdio.h>
#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
-
void GCOMPAT__panic(const char *fmt, ...)
{
va_list va;
diff --git a/libgcompat/math.c b/libgcompat/math.c
index 83abbf4..793ff1a 100644
--- a/libgcompat/math.c
+++ b/libgcompat/math.c
@@ -1,8 +1,8 @@
-#define _GNU_SOURCE /* Extra maths functions */
-#include <math.h> /* Literally everything */
+#define _GNU_SOURCE /* Extra maths functions */
+#include <math.h> /* Literally everything */
-#include "alias.h" /* weak_alias */
-#include "internal.h" /* GCOMPAT__assert_with_reason */
+#include "alias.h" /* weak_alias */
+#include "internal.h" /* GCOMPAT__assert_with_reason */
/**
* Multiplies the first argument x by FLT_RADIX (probably 2) to the power of y.
@@ -14,7 +14,7 @@ long double scalbl(long double x, long double y)
* 1) Good Enough(TM)
* 2) scalbl is deprecated anyway
* */
- return scalblnl(x, (long int)y);
+ return scalblnl(x, (long int) y);
}
/*
@@ -144,7 +144,6 @@ int __isnan(double arg)
}
weak_alias(__isnan, isnan);
-
/**
* Test for a NaN.
*
@@ -290,7 +289,6 @@ long double __asinl_finite(long double x)
return res;
}
-
/**
* Returns the principal value of the arc tangent of x/y, expressed in radians.
*/
@@ -363,7 +361,6 @@ long double __atanhl_finite(long double x)
return res;
}
-
/**
* Returns the hyperbolic cosine of x.
*/
diff --git a/libgcompat/resolv.c b/libgcompat/resolv.c
index f70d913..0b81d0c 100644
--- a/libgcompat/resolv.c
+++ b/libgcompat/resolv.c
@@ -42,7 +42,7 @@ int __res_nclose(res_state statp)
weak_alias(__res_nclose, res_nclose);
int __res_search(const char *dname, int class, int type, unsigned char *answer,
- int anslen)
+ int anslen)
{
return res_search(dname, class, type, answer, anslen);
}
diff --git a/libgcompat/socket.c b/libgcompat/socket.c
index 9919ee0..e56199e 100644
--- a/libgcompat/socket.c
+++ b/libgcompat/socket.c
@@ -1,6 +1,6 @@
#include <assert.h> /* assert */
+#include <poll.h> /* poll, pollfd, nfds_t */
#include <stddef.h> /* NULL */
-#include <poll.h> /* poll, pollfd, nfds_t */
#include <sys/socket.h> /* recv, recvfrom */
/**
diff --git a/libgcompat/string.c b/libgcompat/string.c
index 9f1704b..f4e0620 100644
--- a/libgcompat/string.c
+++ b/libgcompat/string.c
@@ -2,10 +2,10 @@
#include <assert.h> /* assert */
#include <stddef.h> /* NULL, size_t */
#include <stdint.h> /* SIZE_MAX */
-#include <string.h> /* memcpy, strcpy, strncat, strndup */
#include <stdlib.h> /* rand_r */
-#include <unistd.h> /* getpid */
+#include <string.h> /* memcpy, strcpy, strncat, strndup */
#include <time.h> /* time */
+#include <unistd.h> /* getpid */
#include "alias.h" /* weak_alias */
@@ -189,8 +189,7 @@ size_t __strcspn_c2(const char *str, int bad, int bad2)
{
size_t length = 0;
const char *s = str;
- while(*s != bad && *s != bad2 && *s != '\0')
- {
+ while (*s != bad && *s != bad2 && *s != '\0') {
length++;
s++;
}
@@ -285,7 +284,7 @@ char *strfry(char *s)
if (!len)
return s;
- seed += time(NULL) ^ getpid() ^ (uintptr_t)s;
+ seed += time(NULL) ^ getpid() ^ (uintptr_t) s;
for (i = 0; i < len - 1; ++i) {
j = rand_r(&seed) % (len - i) + i;