INN commit: trunk (58 files)
INN Commit
rra at isc.org
Wed Mar 4 20:18:00 UTC 2020
Date: Wednesday, March 4, 2020 @ 12:17:59
Author: iulius
Revision: 10356
Update to latest rra-c-util and C TAP Harness upstream versions
Modified:
trunk/include/clibrary.h
trunk/include/inn/buffer.h
trunk/include/inn/fdflag.h
trunk/include/inn/network-innbind.h
trunk/include/inn/network.h
trunk/include/inn/vector.h
trunk/include/inn/xmalloc.h
trunk/include/portable/getaddrinfo.h
trunk/include/portable/getnameinfo.h
trunk/include/portable/macros.h
trunk/include/portable/socket-unix.h
trunk/include/portable/socket.h
trunk/include/portable/stdbool.h
trunk/include/portable/uio.h
trunk/lib/asprintf.c
trunk/lib/buffer.c
trunk/lib/fdflag.c
trunk/lib/getaddrinfo.c
trunk/lib/getnameinfo.c
trunk/lib/inet_aton.c
trunk/lib/inet_ntoa.c
trunk/lib/inet_ntop.c
trunk/lib/messages.c
trunk/lib/mkstemp.c
trunk/lib/network-innbind.c
trunk/lib/network.c
trunk/lib/reallocarray.c
trunk/lib/setenv.c
trunk/lib/seteuid.c
trunk/lib/snprintf.c
trunk/lib/vector.c
trunk/lib/xmalloc.c
trunk/lib/xwrite.c
trunk/m4/cc-flags.m4
trunk/tests/lib/buffer-t.c
trunk/tests/lib/fakewrite.c
trunk/tests/lib/fdflag-t.c
trunk/tests/lib/getaddrinfo-t.c
trunk/tests/lib/getnameinfo-t.c
trunk/tests/lib/inet_aton-t.c
trunk/tests/lib/inet_ntoa-t.c
trunk/tests/lib/inet_ntop-t.c
trunk/tests/lib/messages-t.c
trunk/tests/lib/network/addr-ipv4-t.c
trunk/tests/lib/network/addr-ipv6-t.c
trunk/tests/lib/network/client-t.c
trunk/tests/lib/network/server-t.c
trunk/tests/lib/snprintf-t.c
trunk/tests/lib/xmalloc.c
trunk/tests/lib/xmalloc.t
trunk/tests/runtests.c
trunk/tests/tap/basic.c
trunk/tests/tap/basic.h
trunk/tests/tap/float.c
trunk/tests/tap/macros.h
trunk/tests/tap/process.c
trunk/tests/tap/process.h
trunk/tests/tap/string.h
---------------------------------+
include/clibrary.h | 30 +++----
include/inn/buffer.h | 26 ++----
include/inn/fdflag.h | 2
include/inn/network-innbind.h | 3
include/inn/network.h | 6 -
include/inn/vector.h | 9 --
include/inn/xmalloc.h | 22 ++---
include/portable/getaddrinfo.h | 60 ++++++++-------
include/portable/getnameinfo.h | 38 +++++----
include/portable/macros.h | 24 +++---
include/portable/socket-unix.h | 4 -
include/portable/socket.h | 128 +++++++++++++++++----------------
include/portable/stdbool.h | 34 ++++----
include/portable/uio.h | 2
lib/asprintf.c | 8 +-
lib/buffer.c | 4 -
lib/fdflag.c | 18 ++--
lib/getaddrinfo.c | 66 ++++++++---------
lib/getnameinfo.c | 16 ++--
lib/inet_aton.c | 10 +-
lib/inet_ntoa.c | 10 +-
lib/inet_ntop.c | 14 ++-
lib/messages.c | 56 +++++++-------
lib/mkstemp.c | 6 -
lib/network-innbind.c | 2
lib/network.c | 24 +++---
lib/reallocarray.c | 4 -
lib/setenv.c | 4 -
lib/seteuid.c | 2
lib/snprintf.c | 4 -
lib/vector.c | 15 +--
lib/xmalloc.c | 8 +-
lib/xwrite.c | 20 ++---
m4/cc-flags.m4 | 4 -
tests/lib/buffer-t.c | 12 +--
tests/lib/fakewrite.c | 4 -
tests/lib/fdflag-t.c | 2
tests/lib/getaddrinfo-t.c | 13 +--
tests/lib/getnameinfo-t.c | 16 ++--
tests/lib/inet_aton-t.c | 8 +-
tests/lib/inet_ntoa-t.c | 6 +
tests/lib/inet_ntop-t.c | 8 +-
tests/lib/messages-t.c | 34 ++++----
tests/lib/network/addr-ipv4-t.c | 8 +-
tests/lib/network/addr-ipv6-t.c | 6 +
tests/lib/network/client-t.c | 15 +--
tests/lib/network/server-t.c | 14 +--
tests/lib/snprintf-t.c | 43 ++++-------
tests/lib/xmalloc.c | 7 +
tests/lib/xmalloc.t | 5 -
tests/runtests.c | 145 ++++++++++++++++++--------------------
tests/tap/basic.c | 46 ++++++------
tests/tap/basic.h | 25 ++----
tests/tap/float.c | 13 +--
tests/tap/macros.h | 32 ++++----
tests/tap/process.c | 18 ++--
tests/tap/process.h | 3
tests/tap/string.h | 2
58 files changed, 587 insertions(+), 581 deletions(-)
Modified: include/clibrary.h
===================================================================
--- include/clibrary.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/clibrary.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -50,28 +50,28 @@
/* A set of standard ANSI C headers. We don't care about pre-ANSI systems. */
#if HAVE_INTTYPES_H
-# include <inttypes.h>
+# include <inttypes.h>
#endif
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#if HAVE_STDINT_H
-# include <stdint.h>
+# include <stdint.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_STRINGS_H
-# include <strings.h>
+# include <strings.h>
#endif
#include <sys/types.h>
#if HAVE_UNISTD_H
-# include <unistd.h>
+# include <unistd.h>
#endif
/* SCO OpenServer gets int32_t from here. */
#if HAVE_SYS_BITYPES_H
-# include <sys/bitypes.h>
+# include <sys/bitypes.h>
#endif
/* Get the bool type. */
@@ -79,12 +79,12 @@
/* In case uint32_t and associated limits weren't defined. */
#ifndef UINT32_MAX
-# define UINT32_MAX 4294967295UL
+# define UINT32_MAX 4294967295UL
#endif
/* Windows provides snprintf under a different name. */
#ifdef _WIN32
-# define snprintf _snprintf
+# define snprintf _snprintf
#endif
/* Define sig_atomic_t if it's not available in signal.h. */
@@ -102,9 +102,9 @@
* been defined, all the rest almost certainly have.
*/
#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-# define STDOUT_FILENO 1
-# define STDERR_FILENO 2
+# define STDIN_FILENO 0
+# define STDOUT_FILENO 1
+# define STDERR_FILENO 2
#endif
/*
@@ -123,11 +123,11 @@
* Autoconf manual, memcpy is a generally portable fallback.
*/
#ifndef va_copy
-# ifdef __va_copy
-# define va_copy(d, s) __va_copy((d), (s))
-# else
-# define va_copy(d, s) memcpy(&(d), &(s), sizeof(va_list))
-# endif
+# ifdef __va_copy
+# define va_copy(d, s) __va_copy((d), (s))
+# else
+# define va_copy(d, s) memcpy(&(d), &(s), sizeof(va_list))
+# endif
#endif
BEGIN_DECLS
Modified: include/inn/buffer.h
===================================================================
--- include/inn/buffer.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/inn/buffer.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -52,10 +52,10 @@
#include <sys/types.h>
struct buffer {
- size_t size; /* Total allocated length. */
- size_t used; /* Data already used. */
- size_t left; /* Remaining unused data. */
- char *data; /* Pointer to allocated memory. */
+ size_t size; /* Total allocated length. */
+ size_t used; /* Data already used. */
+ size_t left; /* Remaining unused data. */
+ char *data; /* Pointer to allocated memory. */
};
BEGIN_DECLS
@@ -71,15 +71,13 @@
* Resize a buffer to be at least as large as the provided size. Invalidates
* pointers into the buffer.
*/
-void buffer_resize(struct buffer *, size_t)
- __attribute__((__nonnull__));
+void buffer_resize(struct buffer *, size_t) __attribute__((__nonnull__));
/*
* Compact a buffer, removing all used data and moving unused data to the
* beginning of the buffer. Invalidates pointers into the buffer.
*/
-void buffer_compact(struct buffer *)
- __attribute__((__nonnull__));
+void buffer_compact(struct buffer *) __attribute__((__nonnull__));
/*
* Set the buffer contents, ignoring anything currently there. If length is
@@ -120,8 +118,7 @@
* the fourth argument. Returns false if the terminator isn't found.
*/
bool buffer_find_string(struct buffer *, const char *, size_t start,
- size_t *offset)
- __attribute__((__nonnull__));
+ size_t *offset) __attribute__((__nonnull__));
/*
* Read from a file descriptor into a buffer, up to the available space in the
@@ -130,15 +127,13 @@
* error or after any successful read. Returns -1 on an error reading from
* the file descriptor and sets errno.
*/
-ssize_t buffer_read(struct buffer *, int fd)
- __attribute__((__nonnull__));
+ssize_t buffer_read(struct buffer *, int fd) __attribute__((__nonnull__));
/*
* Read from a file descriptor into a buffer until end of file is reached.
* Returns true on success and false (setting errno) on error.
*/
-bool buffer_read_all(struct buffer *, int fd)
- __attribute__((__nonnull__));
+bool buffer_read_all(struct buffer *, int fd) __attribute__((__nonnull__));
/*
* Read the contents of a file into a buffer. This should be used instead of
@@ -145,8 +140,7 @@
* buffer_read_all when fstat can be called on the file descriptor. Returns
* true on success and false (setting errno) on error.
*/
-bool buffer_read_file(struct buffer *, int fd)
- __attribute__((__nonnull__));
+bool buffer_read_file(struct buffer *, int fd) __attribute__((__nonnull__));
END_DECLS
Modified: include/inn/fdflag.h
===================================================================
--- include/inn/fdflag.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/inn/fdflag.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -34,8 +34,8 @@
#include <inn/defines.h>
#include "inn/portable-macros.h"
+#include "inn/portable-socket.h"
#include "inn/portable-stdbool.h"
-#include "inn/portable-socket.h"
BEGIN_DECLS
Modified: include/inn/network-innbind.h
===================================================================
--- include/inn/network-innbind.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/inn/network-innbind.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -39,8 +39,7 @@
* count holding the count returned.
*/
bool network_innbind_all(int type, unsigned short port, socket_type **fds,
- unsigned int *count)
- __attribute__((__nonnull__));
+ unsigned int *count) __attribute__((__nonnull__));
END_DECLS
Modified: include/inn/network.h
===================================================================
--- include/inn/network.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/inn/network.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -65,8 +65,7 @@
* array of file descriptors when no longer needed.
*/
bool network_bind_all(int type, unsigned short port, socket_type **fds,
- unsigned int *count)
- __attribute__((__nonnull__));
+ unsigned int *count) __attribute__((__nonnull__));
void network_bind_all_free(socket_type *fds);
/*
@@ -102,8 +101,7 @@
* not use any particular source address.)
*/
socket_type network_connect(const struct addrinfo *, const char *source,
- time_t)
- __attribute__((__nonnull__(1)));
+ time_t) __attribute__((__nonnull__(1)));
/*
* Like network_connect but takes a host and port instead. If host lookup
Modified: include/inn/vector.h
===================================================================
--- include/inn/vector.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/inn/vector.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -67,8 +67,7 @@
* Resize the array of strings to hold size entries. Saves reallocation work
* in vector_add if it's known in advance how many entries there will be.
*/
-void vector_resize(struct vector *, size_t size)
- __attribute__((__nonnull__));
+void vector_resize(struct vector *, size_t size) __attribute__((__nonnull__));
void cvector_resize(struct cvector *, size_t size)
__attribute__((__nonnull__));
@@ -77,10 +76,8 @@
* regular vector, but not freeing the strings array (to cut down on memory
* allocations if the vector will be reused).
*/
-void vector_clear(struct vector *)
- __attribute__((__nonnull__));
-void cvector_clear(struct cvector *)
- __attribute__((__nonnull__));
+void vector_clear(struct vector *) __attribute__((__nonnull__));
+void cvector_clear(struct cvector *) __attribute__((__nonnull__));
/*
* Free the vector and all resources allocated for it. NULL may be passed in
Modified: include/inn/xmalloc.h
===================================================================
--- include/inn/xmalloc.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/inn/xmalloc.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -43,12 +43,12 @@
* number information for debugging error messages without the user having to
* pass those in every time.
*/
-#define xcalloc(n, size) x_calloc((n), (size), __FILE__, __LINE__)
-#define xmalloc(size) x_malloc((size), __FILE__, __LINE__)
-#define xrealloc(p, size) x_realloc((p), (size), __FILE__, __LINE__)
-#define xstrdup(p) x_strdup((p), __FILE__, __LINE__)
-#define xstrndup(p, size) x_strndup((p), (size), __FILE__, __LINE__)
-#define xvasprintf(p, f, a) x_vasprintf((p), (f), (a), __FILE__, __LINE__)
+#define xcalloc(n, size) x_calloc((n), (size), __FILE__, __LINE__)
+#define xmalloc(size) x_malloc((size), __FILE__, __LINE__)
+#define xrealloc(p, size) x_realloc((p), (size), __FILE__, __LINE__)
+#define xstrdup(p) x_strdup((p), __FILE__, __LINE__)
+#define xstrndup(p, size) x_strndup((p), (size), __FILE__, __LINE__)
+#define xvasprintf(p, f, a) x_vasprintf((p), (f), (a), __FILE__, __LINE__)
#define xreallocarray(p, n, size) \
x_reallocarray((p), (n), (size), __FILE__, __LINE__)
@@ -61,13 +61,13 @@
* are supported.
*/
#ifdef INN_HAVE_C99_VAMACROS
-# define xasprintf(p, f, ...) \
- x_asprintf((p), __FILE__, __LINE__, (f), __VA_ARGS__)
+# define xasprintf(p, f, ...) \
+ x_asprintf((p), __FILE__, __LINE__, (f), __VA_ARGS__)
#elif INN_HAVE_GNU_VAMACROS
-# define xasprintf(p, f, args...) \
- x_asprintf((p), __FILE__, __LINE__, (f), args)
+# define xasprintf(p, f, args...) \
+ x_asprintf((p), __FILE__, __LINE__, (f), args)
#else
-# define xasprintf x_asprintf
+# define xasprintf x_asprintf
#endif
BEGIN_DECLS
Modified: include/portable/getaddrinfo.h
===================================================================
--- include/portable/getaddrinfo.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/portable/getaddrinfo.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -4,7 +4,7 @@
*
* This is an implementation of the getaddrinfo family of functions for
* systems that lack it, so that code can use getaddrinfo always. It provides
- * IPv4 support only; for IPv6 support, a native getaddrinfo implemenation is
+ * IPv4 support only; for IPv6 support, a native getaddrinfo implementation is
* required.
*
* This file should generally be included by way of portable/socket.h rather
@@ -14,7 +14,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2003, 2005 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2003, 2005, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2008-2011
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -36,41 +36,43 @@
#ifndef HAVE_GETADDRINFO
/* OpenBSD likes to have sys/types.h included before sys/socket.h. */
-#include <sys/types.h>
-#include <sys/socket.h>
+/* clang-format off */
+# include <sys/types.h>
+# include <sys/socket.h>
+/* clang-format on */
/* The struct returned by getaddrinfo, from RFC 3493. */
struct addrinfo {
- int ai_flags; /* AI_PASSIVE, AI_CANONNAME, .. */
- int ai_family; /* AF_xxx */
- int ai_socktype; /* SOCK_xxx */
- int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
- socklen_t ai_addrlen; /* Length of ai_addr */
- char *ai_canonname; /* Canonical name for nodename */
- struct sockaddr *ai_addr; /* Binary address */
- struct addrinfo *ai_next; /* Next structure in linked list */
+ int ai_flags; /* AI_PASSIVE, AI_CANONNAME, .. */
+ int ai_family; /* AF_xxx */
+ int ai_socktype; /* SOCK_xxx */
+ int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
+ socklen_t ai_addrlen; /* Length of ai_addr */
+ char *ai_canonname; /* Canonical name for nodename */
+ struct sockaddr *ai_addr; /* Binary address */
+ struct addrinfo *ai_next; /* Next structure in linked list */
};
/* Constants for ai_flags from RFC 3493, combined with binary or. */
-#define AI_PASSIVE 0x0001
-#define AI_CANONNAME 0x0002
-#define AI_NUMERICHOST 0x0004
-#define AI_NUMERICSERV 0x0008
-#define AI_V4MAPPED 0x0010
-#define AI_ALL 0x0020
-#define AI_ADDRCONFIG 0x0040
+# define AI_PASSIVE 0x0001
+# define AI_CANONNAME 0x0002
+# define AI_NUMERICHOST 0x0004
+# define AI_NUMERICSERV 0x0008
+# define AI_V4MAPPED 0x0010
+# define AI_ALL 0x0020
+# define AI_ADDRCONFIG 0x0040
/* Error return codes from RFC 3493. */
-#define EAI_AGAIN 1 /* Temporary name resolution failure */
-#define EAI_BADFLAGS 2 /* Invalid value in ai_flags parameter */
-#define EAI_FAIL 3 /* Permanent name resolution failure */
-#define EAI_FAMILY 4 /* Address family not recognized */
-#define EAI_MEMORY 5 /* Memory allocation failure */
-#define EAI_NONAME 6 /* nodename or servname unknown */
-#define EAI_SERVICE 7 /* Service not recognized for socket type */
-#define EAI_SOCKTYPE 8 /* Socket type not recognized */
-#define EAI_SYSTEM 9 /* System error occurred, see errno */
-#define EAI_OVERFLOW 10 /* An argument buffer overflowed */
+# define EAI_AGAIN 1 /* Temporary name resolution failure */
+# define EAI_BADFLAGS 2 /* Invalid value in ai_flags parameter */
+# define EAI_FAIL 3 /* Permanent name resolution failure */
+# define EAI_FAMILY 4 /* Address family not recognized */
+# define EAI_MEMORY 5 /* Memory allocation failure */
+# define EAI_NONAME 6 /* nodename or servname unknown */
+# define EAI_SERVICE 7 /* Service not recognized for socket type */
+# define EAI_SOCKTYPE 8 /* Socket type not recognized */
+# define EAI_SYSTEM 9 /* System error occurred, see errno */
+# define EAI_OVERFLOW 10 /* An argument buffer overflowed */
BEGIN_DECLS
Modified: include/portable/getnameinfo.h
===================================================================
--- include/portable/getnameinfo.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/portable/getnameinfo.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -4,7 +4,7 @@
*
* This is an implementation of the getnameinfo function for systems that lack
* it, so that code can use getnameinfo always. It provides IPv4 support
- * only; for IPv6 support, a native getnameinfo implemenation is required.
+ * only; for IPv6 support, a native getnameinfo implementation is required.
*
* This file should generally be included by way of portable/socket.h rather
* than directly.
@@ -13,7 +13,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005, 2007 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2005, 2007, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2008, 2010-2011
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -35,15 +35,17 @@
#if !HAVE_GETNAMEINFO
/* OpenBSD likes to have sys/types.h included before sys/socket.h. */
-#include <sys/types.h>
-#include <sys/socket.h>
+/* clang-format off */
+# include <sys/types.h>
+# include <sys/socket.h>
+/* clang-format on */
/* Constants for flags from RFC 3493, combined with binary or. */
-#define NI_NOFQDN 0x0001
-#define NI_NUMERICHOST 0x0002
-#define NI_NAMEREQD 0x0004
-#define NI_NUMERICSERV 0x0008
-#define NI_DGRAM 0x0010
+# define NI_NOFQDN 0x0001
+# define NI_NUMERICHOST 0x0002
+# define NI_NAMEREQD 0x0004
+# define NI_NUMERICSERV 0x0008
+# define NI_DGRAM 0x0010
/*
* Maximum length of hostnames and service names. Our implementation doesn't
@@ -50,19 +52,19 @@
* use these values, so they're taken from Linux. They're provided just for
* code that uses them to size buffers.
*/
-#ifndef NI_MAXHOST
-# define NI_MAXHOST 1025
-#endif
-#ifndef NI_MAXSERV
-# define NI_MAXSERV 32
-#endif
+# ifndef NI_MAXHOST
+# define NI_MAXHOST 1025
+# endif
+# ifndef NI_MAXSERV
+# define NI_MAXSERV 32
+# endif
BEGIN_DECLS
/* Function prototypes. */
-int getnameinfo(const struct sockaddr *sa, socklen_t salen,
- char *node, socklen_t nodelen,
- char *service, socklen_t servicelen, int flags);
+int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *node,
+ socklen_t nodelen, char *service, socklen_t servicelen,
+ int flags);
END_DECLS
Modified: include/portable/macros.h
===================================================================
--- include/portable/macros.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/portable/macros.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -27,9 +27,9 @@
* (to avoid confusion with other macros).
*/
#ifndef __attribute__
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __attribute__(spec) /* empty */
-# endif
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+# define __attribute__(spec) /* empty */
+# endif
#endif
/*
@@ -40,10 +40,10 @@
* variadic macro support.
*/
#if !defined(__attribute__) && !defined(__alloc_size__)
-# if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)) \
- && !defined(__clang__)
-# define __alloc_size__(spec, args...) /* empty */
-# endif
+# if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)) \
+ && !defined(__clang__)
+# define __alloc_size__(spec, args...) /* empty */
+# endif
#endif
/*
@@ -53,7 +53,7 @@
* compilation context, but there's no push and pop available.
*/
#if !defined(__attribute__) && (defined(__llvm__) || defined(__clang__))
-# pragma GCC diagnostic ignored "-Wattributes"
+# pragma GCC diagnostic ignored "-Wattributes"
#endif
/*
@@ -63,11 +63,11 @@
#undef BEGIN_DECLS
#undef END_DECLS
#ifdef __cplusplus
-# define BEGIN_DECLS extern "C" {
-# define END_DECLS }
+# define BEGIN_DECLS extern "C" {
+# define END_DECLS }
#else
-# define BEGIN_DECLS /* empty */
-# define END_DECLS /* empty */
+# define BEGIN_DECLS /* empty */
+# define END_DECLS /* empty */
#endif
#endif /* !PORTABLE_MACROS_H */
Modified: include/portable/socket-unix.h
===================================================================
--- include/portable/socket-unix.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/portable/socket-unix.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -33,8 +33,8 @@
* (2nd edition), vol. 1, pg. 917.
*/
#if !HAVE_SUN_LEN
-# define SUN_LEN(sun) \
- (sizeof(*(sun)) - sizeof((sun)->sun_path) + strlen((sun)->sun_path))
+# define SUN_LEN(sun) \
+ (sizeof(*(sun)) - sizeof((sun)->sun_path) + strlen((sun)->sun_path))
#endif
#endif /* !PORTABLE_SOCKET_UNIX_H */
Modified: include/portable/socket.h
===================================================================
--- include/portable/socket.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/portable/socket.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -17,7 +17,7 @@
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
- * Copyright 2014, 2017 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2014, 2017, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2008-2009, 2011, 2013
* The Board of Trustees of the Leland Stanford Junior University
* Copyright 2004-2007 Internet Systems Consortium, Inc. ("ISC")
@@ -51,15 +51,17 @@
#include <sys/types.h>
/* BSDI needs <netinet/in.h> before <arpa/inet.h>. */
+/* clang-format off */
#ifdef _WIN32
-# include <winsock2.h>
-# include <ws2tcpip.h>
+# include <winsock2.h>
+# include <ws2tcpip.h>
#else
-# include <netinet/in.h>
-# include <arpa/inet.h>
-# include <netdb.h>
-# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# include <netdb.h>
+# include <sys/socket.h>
#endif
+/* clang-format on */
/*
* Pick up definitions of getaddrinfo and getnameinfo if not otherwise
@@ -79,18 +81,19 @@
* platforms that may require 64-bit alignment for the embedded addresses.
*/
#if !HAVE_STRUCT_SOCKADDR_STORAGE
-# define SS_MAXSIZE_ 128
-# ifdef HAVE_LONG_LONG_INT
-# define SS_ALIGNSIZE_ sizeof(long long)
-# define SS_ALIGNTYPE_ long long
-# else
-# define SS_ALIGNSIZE_ sizeof(long)
-# define SS_ALIGNTYPE_ long
-# endif
-# if HAVE_STRUCT_SOCKADDR_SA_LEN
-# define SS_PAD1SIZE_ (SS_ALIGNSIZE_ - 2 * sizeof(unsigned char))
-# define SS_PAD2SIZE_ \
- (SS_MAXSIZE_ - (2 * sizeof(unsigned char) + SS_PAD1SIZE_ + SS_ALIGNSIZE_))
+# define SS_MAXSIZE_ 128
+# ifdef HAVE_LONG_LONG_INT
+# define SS_ALIGNSIZE_ sizeof(long long)
+# define SS_ALIGNTYPE_ long long
+# else
+# define SS_ALIGNSIZE_ sizeof(long)
+# define SS_ALIGNTYPE_ long
+# endif
+# if HAVE_STRUCT_SOCKADDR_SA_LEN
+# define SS_PAD1SIZE_ (SS_ALIGNSIZE_ - 2 * sizeof(unsigned char))
+# define SS_PAD2SIZE_ \
+ (SS_MAXSIZE_ \
+ - (2 * sizeof(unsigned char) + SS_PAD1SIZE_ + SS_ALIGNSIZE_))
struct sockaddr_storage {
unsigned char ss_len;
unsigned char ss_family;
@@ -98,10 +101,11 @@
SS_ALIGNTYPE_ __ss_align;
char __ss_pad2[SS_PAD2SIZE_];
};
-# else
-# define SS_PAD1SIZE_ (SS_ALIGNSIZE_ - sizeof(unsigned char))
-# define SS_PAD2SIZE_ \
- (SS_MAXSIZE_ - (sizeof(unsigned char) + SS_PAD1SIZE_ + SS_ALIGNSIZE_))
+# else
+# define SS_PAD1SIZE_ (SS_ALIGNSIZE_ - sizeof(unsigned char))
+# define SS_PAD2SIZE_ \
+ (SS_MAXSIZE_ \
+ - (sizeof(unsigned char) + SS_PAD1SIZE_ + SS_ALIGNSIZE_))
struct sockaddr_storage {
unsigned short ss_family;
char __ss_pad1[SS_PAD1SIZE_];
@@ -108,7 +112,7 @@
SS_ALIGNTYPE_ __ss_align;
char __ss_pad2[SS_PAD2SIZE_];
};
-# endif
+# endif
#endif
/*
@@ -116,15 +120,15 @@
* instead of the non-uglified names from RFC 3493.
*/
#if HAVE_STRUCT_SOCKADDR_STORAGE && !HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
-# define ss_family __ss_family
-# define ss_len __ss_len
+# define ss_family __ss_family
+# define ss_len __ss_len
#endif
/* Fix IN6_ARE_ADDR_EQUAL if required. */
#ifdef HAVE_BROKEN_IN6_ARE_ADDR_EQUAL
-# undef IN6_ARE_ADDR_EQUAL
-# define IN6_ARE_ADDR_EQUAL(a, b) \
- (memcmp((a), (b), sizeof(struct in6_addr)) == 0)
+# undef IN6_ARE_ADDR_EQUAL
+# define IN6_ARE_ADDR_EQUAL(a, b) \
+ (memcmp((a), (b), sizeof(struct in6_addr)) == 0)
#endif
/*
@@ -133,7 +137,7 @@
* doesn't exist.
*/
#if !defined(HAVE_GETADDRINFO_ADDRCONFIG) && defined(AI_ADDRCONFIG)
-# undef AI_ADDRCONFIG
+# undef AI_ADDRCONFIG
#endif
/*
@@ -143,10 +147,10 @@
* them harmlessly go away.
*/
#ifndef AI_ADDRCONFIG
-# define AI_ADDRCONFIG 0
+# define AI_ADDRCONFIG 0
#endif
#ifndef AI_NUMERICSERV
-# define AI_NUMERICSERV 0
+# define AI_NUMERICSERV 0
#endif
/*
@@ -154,10 +158,10 @@
* nul-terminated text representation of the given address type.
*/
#ifndef INET_ADDRSTRLEN
-# define INET_ADDRSTRLEN 16
+# define INET_ADDRSTRLEN 16
#endif
#ifndef INET6_ADDRSTRLEN
-# define INET6_ADDRSTRLEN 46
+# define INET6_ADDRSTRLEN 46
#endif
/*
@@ -165,7 +169,7 @@
* available on systems too old to have that function.
*/
#ifndef EAFNOSUPPORT
-# define EAFNOSUPPORT EDOM
+# define EAFNOSUPPORT EDOM
#endif
/*
@@ -175,7 +179,7 @@
* unconditionally.
*/
#ifndef EAI_ADDRFAMILY
-# define EAI_ADDRFAMILY EAI_FAMILY
+# define EAI_ADDRFAMILY EAI_FAMILY
#endif
BEGIN_DECLS
@@ -187,28 +191,28 @@
* accordingly.
*/
#if !HAVE_DECL_INET_ATON
-# if !HAVE_INET_ATON
+# if !HAVE_INET_ATON
extern int inet_aton(const char *, struct in_addr *)
__attribute__((__visibility__("hidden")));
-# else
+# else
extern int inet_aton(const char *, struct in_addr *);
-# endif
+# endif
#endif
#if !HAVE_DECL_INET_NTOA
-# if !HAVE_INET_NTOA
+# if !HAVE_INET_NTOA
extern char *inet_ntoa(struct in_addr)
__attribute__((__visibility__("hidden")));
-# else
+# else
extern char *inet_ntoa(struct in_addr);
-# endif
+# endif
#endif
#if !HAVE_INET_NTOP
-# ifdef _WIN32
+# ifdef _WIN32
extern const char *inet_ntop(int, const void *, char *, int);
-# else
+# else
extern const char *inet_ntop(int, const void *, char *, socklen_t);
-# endif
+# endif
#endif
/*
@@ -240,26 +244,26 @@
*/
#ifdef _WIN32
int socket_init(void);
-# define socket_shutdown() WSACleanup()
-# define socket_close(fd) closesocket(fd)
-# define socket_read(fd, b, s) recv((fd), (b), (s), 0)
-# define socket_write(fd, b, s) send((fd), (b), (s), 0)
-# define socket_errno WSAGetLastError()
-# define socket_set_errno(e) WSASetLastError(e)
-# define socket_set_errno_einval() WSASetLastError(WSAEINVAL)
+# define socket_shutdown() WSACleanup()
+# define socket_close(fd) closesocket(fd)
+# define socket_read(fd, b, s) recv((fd), (b), (s), 0)
+# define socket_write(fd, b, s) send((fd), (b), (s), 0)
+# define socket_errno WSAGetLastError()
+# define socket_set_errno(e) WSASetLastError(e)
+# define socket_set_errno_einval() WSASetLastError(WSAEINVAL)
const char *socket_strerror(int);
typedef SOCKET socket_type;
#else
-# define socket_init() 1
-# define socket_shutdown() /* empty */
-# define socket_close(fd) close(fd)
-# define socket_read(fd, b, s) read((fd), (b), (s))
-# define socket_write(fd, b, s) write((fd), (b), (s))
-# define socket_errno errno
-# define socket_set_errno(e) errno = (e)
-# define socket_set_errno_einval() errno = EINVAL
-# define socket_strerror(e) strerror(e)
-# define INVALID_SOCKET -1
+# define socket_init() 1
+# define socket_shutdown() /* empty */
+# define socket_close(fd) close(fd)
+# define socket_read(fd, b, s) read((fd), (b), (s))
+# define socket_write(fd, b, s) write((fd), (b), (s))
+# define socket_errno errno
+# define socket_set_errno(e) errno = (e)
+# define socket_set_errno_einval() errno = EINVAL
+# define socket_strerror(e) strerror(e)
+# define INVALID_SOCKET -1
typedef int socket_type;
#endif
Modified: include/portable/stdbool.h
===================================================================
--- include/portable/stdbool.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/portable/stdbool.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -29,28 +29,28 @@
* stripped-down version of config.h with a different name.
*/
#ifndef CONFIG_H_INCLUDED
-# include "config.h"
+# include "config.h"
#endif
#if HAVE_STDBOOL_H
-# include <stdbool.h>
+# include <stdbool.h>
#else
-# if HAVE__BOOL
-# define bool _Bool
-# else
-# ifdef __cplusplus
+# if HAVE__BOOL
+# define bool _Bool
+# else
+# ifdef __cplusplus
typedef bool _Bool;
-# elif _WIN32
-# include <windef.h>
-# define bool BOOL
-# else
+# elif _WIN32
+# include <windef.h>
+# define bool BOOL
+# else
typedef unsigned char _Bool;
-# define bool _Bool
-# endif
-# endif
-# define false 0
-# define true 1
-# define __bool_true_false_are_defined 1
+# define bool _Bool
+# endif
+# endif
+# define false 0
+# define true 1
+# define __bool_true_false_are_defined 1
#endif
/*
@@ -58,7 +58,7 @@
* fail. Only of interest for programs that also include Perl headers.
*/
#ifndef HAS_BOOL
-# define HAS_BOOL 1
+# define HAS_BOOL 1
#endif
#endif /* !PORTABLE_STDBOOL_H */
Modified: include/portable/uio.h
===================================================================
--- include/portable/uio.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ include/portable/uio.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -28,7 +28,7 @@
/* remctl.h provides its own definition of this struct on Windows. */
#if defined(HAVE_SYS_UIO_H)
-# include <sys/uio.h>
+# include <sys/uio.h>
#elif !defined(REMCTL_H)
struct iovec {
void *iov_base;
Modified: lib/asprintf.c
===================================================================
--- lib/asprintf.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/asprintf.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -32,10 +32,10 @@
* with the system versions.
*/
#if TESTING
-# undef asprintf
-# undef vasprintf
-# define asprintf test_asprintf
-# define vasprintf test_vasprintf
+# undef asprintf
+# undef vasprintf
+# define asprintf test_asprintf
+# define vasprintf test_vasprintf
int test_asprintf(char **, const char *, ...)
__attribute__((__format__(printf, 2, 3)));
int test_vasprintf(char **, const char *, va_list)
Modified: lib/buffer.c
===================================================================
--- lib/buffer.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/buffer.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -17,7 +17,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2015-2016 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2015-2016, 2019 Russ Allbery <eagle at eyrie.org>
* Copyright 2011-2012, 2014
* The Board of Trustees of the Leland Stanford Junior University
* Copyright 2004-2006 Internet Systems Consortium, Inc. ("ISC")
@@ -44,6 +44,7 @@
#include "config.h"
#include "clibrary.h"
+#include <assert.h>
#include <errno.h>
#include <sys/stat.h>
@@ -112,6 +113,7 @@
buffer_set(struct buffer *buffer, const char *data, size_t length)
{
if (length > 0) {
+ assert(data != NULL);
buffer_resize(buffer, length);
memmove(buffer->data, data, length);
}
Modified: lib/fdflag.c
===================================================================
--- lib/fdflag.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/fdflag.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -36,15 +36,15 @@
#include "clibrary.h"
#ifdef _WIN32
-# include <winsock2.h>
+# include <winsock2.h>
#else
-# include <fcntl.h>
-# ifndef O_NONBLOCK
-# include <sys/ioctl.h>
-# if HAVE_SYS_FILIO_H
-# include <sys/filio.h>
-# endif
-# endif
+# include <fcntl.h>
+# ifndef O_NONBLOCK
+# include <sys/ioctl.h>
+# if HAVE_SYS_FILIO_H
+# include <sys/filio.h>
+# endif
+# endif
#endif
#include "inn/fdflag.h"
@@ -142,7 +142,7 @@
mode = (flag ? (mode | O_NONBLOCK) : (mode & ~O_NONBLOCK));
return (fcntl(fd, F_SETFL, mode) == 0);
}
-#else /* !O_NONBLOCK */
+#else /* !O_NONBLOCK */
bool
fdflag_nonblocking(socket_type fd, bool flag)
{
Modified: lib/getaddrinfo.c
===================================================================
--- lib/getaddrinfo.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/getaddrinfo.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -3,7 +3,7 @@
* Replacement for a missing getaddrinfo.
*
* This is an implementation of getaddrinfo for systems that don't have one so
- * that networking code can use a consistant interface without #ifdef. It is
+ * that networking code can use a consistent interface without #ifdef. It is
* a fairly minimal implementation, with the following limitations:
*
* - IPv4 support only. IPv6 is not supported.
@@ -21,7 +21,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2003-2005, 2016-2017, 2019 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2003-2005, 2016-2017, 2019-2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2015 Julien ÃLIE <julien at trigofacile.com>
* Copyright 2008, 2011, 2013-2014
* The Board of Trustees of the Leland Stanford Junior University
@@ -35,8 +35,8 @@
*/
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include <errno.h>
@@ -51,13 +51,13 @@
* defined so that we can deal with them in case statements.
*/
#ifndef HOST_NOT_FOUND
-# define HOST_NOT_FOUND 1
-# define TRY_AGAIN 2
-# define NO_RECOVERY 3
-# define NO_DATA 4
+# define HOST_NOT_FOUND 1
+# define TRY_AGAIN 2
+# define NO_RECOVERY 3
+# define NO_DATA 4
#endif
#ifndef NETDB_INTERNAL
-# define NETDB_INTERNAL -1
+# define NETDB_INTERNAL -1
#endif
/*
@@ -66,12 +66,12 @@
* constants, but that should be okay (except possibly for gai_strerror).
*/
#if TESTING
-# undef gai_strerror
-# undef freeaddrinfo
-# undef getaddrinfo
-# define gai_strerror test_gai_strerror
-# define freeaddrinfo test_freeaddrinfo
-# define getaddrinfo test_getaddrinfo
+# undef gai_strerror
+# undef freeaddrinfo
+# undef getaddrinfo
+# define gai_strerror test_gai_strerror
+# define freeaddrinfo test_freeaddrinfo
+# define getaddrinfo test_getaddrinfo
const char *test_gai_strerror(int);
void test_freeaddrinfo(struct addrinfo *);
int test_getaddrinfo(const char *, const char *, const struct addrinfo *,
@@ -83,14 +83,14 @@
* pick some other values for them.
*/
#if TESTING
-# if AI_NUMERICSERV == 0
-# undef AI_NUMERICSERV
-# define AI_NUMERICSERV 0x0080
-# endif
-# if AI_NUMERICHOST == 0
-# undef AI_NUMERICHOST
-# define AI_NUMERICHOST 0x0100
-# endif
+# if AI_NUMERICSERV == 0
+# undef AI_NUMERICSERV
+# define AI_NUMERICSERV 0x0080
+# endif
+# if AI_NUMERICHOST == 0
+# undef AI_NUMERICHOST
+# define AI_NUMERICHOST 0x0100
+# endif
#endif
/*
@@ -99,17 +99,17 @@
* on these platforms.
*/
#if TESTING
-# ifdef HAVE_GETADDRINFO
-# define AI_INTERNAL_ALL 0x1fff
-# else
-# define AI_INTERNAL_ALL 0x01ff
-# endif
+# ifdef HAVE_GETADDRINFO
+# define AI_INTERNAL_ALL 0x1fff
+# else
+# define AI_INTERNAL_ALL 0x01ff
+# endif
#else
-# define AI_INTERNAL_ALL 0x007f
+# define AI_INTERNAL_ALL 0x007f
#endif
/* Table of strings corresponding to the EAI_* error codes. */
-static const char * const gai_errors[] = {
+static const char *const gai_errors[] = {
"Host name lookup failure", /* 1 EAI_AGAIN */
"Invalid flag value", /* 2 EAI_BADFLAGS */
"Unknown server error", /* 3 EAI_FAIL */
@@ -124,9 +124,9 @@
/* Macro to set the len attribute of sockaddr_in. */
#if HAVE_STRUCT_SOCKADDR_SA_LEN
-# define sin_set_length(s) ((s)->sin_len = sizeof(struct sockaddr_in))
+# define sin_set_length(s) ((s)->sin_len = sizeof(struct sockaddr_in))
#else
-# define sin_set_length(s) /* empty */
+# define sin_set_length(s) /* empty */
#endif
/*
@@ -332,8 +332,8 @@
if (host->h_addr_list[0] == NULL)
return EAI_FAIL;
canonical = (flags & AI_CANONNAME)
- ? ((host->h_name != NULL) ? host->h_name : nodename)
- : NULL;
+ ? ((host->h_name != NULL) ? host->h_name : nodename)
+ : NULL;
first = NULL;
prev = NULL;
for (i = 0; host->h_addr_list[i] != NULL; i++) {
Modified: lib/getnameinfo.c
===================================================================
--- lib/getnameinfo.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/getnameinfo.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -3,7 +3,7 @@
* Replacement for a missing getnameinfo.
*
* This is an implementation of getnameinfo for systems that don't have one so
- * that networking code can use a consistant interface without #ifdef. It is
+ * that networking code can use a consistent interface without #ifdef. It is
* a fairly minimal implementation, with the following limitations:
*
* - IPv4 support only. IPv6 is not supported.
@@ -18,7 +18,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2005, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2008, 2011, 2013-2014
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -43,19 +43,19 @@
* constants, but that should be okay (except possibly for gai_strerror).
*/
#if TESTING
-# undef getnameinfo
-# define getnameinfo test_getnameinfo
+# undef getnameinfo
+# define getnameinfo test_getnameinfo
int test_getnameinfo(const struct sockaddr *, socklen_t, char *, socklen_t,
char *, socklen_t, int);
/* Linux doesn't provide EAI_OVERFLOW, so make up our own for testing. */
-# ifndef EAI_OVERFLOW
-# define EAI_OVERFLOW 10
-# endif
+# ifndef EAI_OVERFLOW
+# define EAI_OVERFLOW 10
+# endif
#endif
/* Used for unused parameters to silence gcc warnings. */
-#define UNUSED __attribute__((__unused__))
+#define UNUSED __attribute__((__unused__))
/*
Modified: lib/inet_aton.c
===================================================================
--- lib/inet_aton.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/inet_aton.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -10,7 +10,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2000-2001, 2017, 2019 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2000-2001, 2017, 2019-2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2008, 2011, 2014
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -23,8 +23,8 @@
*/
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
/*
* If we're running the test suite, rename inet_aton to avoid conflicts with
@@ -31,8 +31,8 @@
* the system version.
*/
#if TESTING
-# undef inet_aton
-# define inet_aton test_inet_aton
+# undef inet_aton
+# define inet_aton test_inet_aton
int test_inet_aton(const char *, struct in_addr *);
#endif
@@ -98,6 +98,7 @@
* Use a switch statement to parse each digit rather than assuming
* ASCII. Probably pointless portability.
*/
+ /* clang-format off */
switch (*p) {
case '0': i = 0; break;
case '1': i = 1; break;
@@ -117,6 +118,7 @@
case 'F': case 'f': i = 15; break;
default: return 0;
}
+ /* clang-format on */
if (i >= base)
return 0;
octet[part] = (octet[part] * base) + i;
Modified: lib/inet_ntoa.c
===================================================================
--- lib/inet_ntoa.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/inet_ntoa.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -11,7 +11,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2000-2001, 2017 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2000-2001, 2017, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2008, 2011, 2014
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -24,8 +24,8 @@
*/
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
/*
* If we're running the test suite, rename inet_ntoa to avoid conflicts with
@@ -32,8 +32,8 @@
* the system version.
*/
#if TESTING
-# undef inet_ntoa
-# define inet_ntoa test_inet_ntoa
+# undef inet_ntoa
+# define inet_ntoa test_inet_ntoa
char *test_inet_ntoa(struct in_addr);
#endif
@@ -44,8 +44,10 @@
const unsigned char *p;
p = (const unsigned char *) &in.s_addr;
+ /* clang-format off */
sprintf(buf, "%u.%u.%u.%u",
(unsigned int) (p[0] & 0xff), (unsigned int) (p[1] & 0xff),
(unsigned int) (p[2] & 0xff), (unsigned int) (p[3] & 0xff));
+ /* clang-format on */
return buf;
}
Modified: lib/inet_ntop.c
===================================================================
--- lib/inet_ntop.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/inet_ntop.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -12,7 +12,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2005, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2008, 2011, 2013-2014
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -25,19 +25,19 @@
*/
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include <errno.h>
/* This may already be defined by the system headers. */
#ifndef INET_ADDRSTRLEN
-# define INET_ADDRSTRLEN 16
+# define INET_ADDRSTRLEN 16
#endif
/* Systems old enough to not support inet_ntop may not have this either. */
#ifndef EAFNOSUPPORT
-# define EAFNOSUPPORT EDOM
+# define EAFNOSUPPORT EDOM
#endif
/*
@@ -45,8 +45,8 @@
* the system version.
*/
#if TESTING
-# undef inet_ntop
-# define inet_ntop test_inet_ntop
+# undef inet_ntop
+# define inet_ntop test_inet_ntop
const char *test_inet_ntop(int, const void *, char *, socklen_t);
#endif
@@ -65,11 +65,13 @@
return NULL;
}
p = src;
+ /* clang-format off */
status = snprintf(dst, size, "%u.%u.%u.%u",
(unsigned int) (p[0] & 0xff),
(unsigned int) (p[1] & 0xff),
(unsigned int) (p[2] & 0xff),
(unsigned int) (p[3] & 0xff));
+ /* clang-format on */
if (status < 0 || (size_t) status >= (size_t) size)
return NULL;
return dst;
Modified: lib/messages.c
===================================================================
--- lib/messages.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/messages.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -55,7 +55,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2015-2016 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2015-2016, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2008-2010, 2013-2014
* The Board of Trustees of the Leland Stanford Junior University
* Copyright 2004-2006 Internet Systems Consortium, Inc. ("ISC")
@@ -84,17 +84,17 @@
#include <errno.h>
#ifdef HAVE_SYSLOG_H
-# include <syslog.h>
+# include <syslog.h>
#endif
#ifdef _WIN32
-# include <windows.h>
-# define LOG_DEBUG EVENTLOG_SUCCESS
-# define LOG_INFO EVENTLOG_INFORMATION_TYPE
-# define LOG_NOTICE EVENTLOG_INFORMATION_TYPE
-# define LOG_WARNING EVENTLOG_WARNING_TYPE
-# define LOG_ERR EVENTLOG_ERROR_TYPE
-# define LOG_CRIT EVENTLOG_ERROR_TYPE
+# include <windows.h>
+# define LOG_DEBUG EVENTLOG_SUCCESS
+# define LOG_INFO EVENTLOG_INFORMATION_TYPE
+# define LOG_NOTICE EVENTLOG_INFORMATION_TYPE
+# define LOG_WARNING EVENTLOG_WARNING_TYPE
+# define LOG_ERR EVENTLOG_ERROR_TYPE
+# define LOG_CRIT EVENTLOG_ERROR_TYPE
#endif
#include "inn/macros.h"
@@ -102,18 +102,14 @@
#include "inn/xmalloc.h"
/* The default handler lists. */
-static message_handler_func stdout_handlers[2] = {
- message_log_stdout, NULL
-};
-static message_handler_func stderr_handlers[2] = {
- message_log_stderr, NULL
-};
+static message_handler_func stdout_handlers[2] = {message_log_stdout, NULL};
+static message_handler_func stderr_handlers[2] = {message_log_stderr, NULL};
/* The list of logging functions currently in effect. */
-static message_handler_func *debug_handlers = NULL;
+static message_handler_func *debug_handlers = NULL;
static message_handler_func *notice_handlers = stdout_handlers;
-static message_handler_func *warn_handlers = stderr_handlers;
-static message_handler_func *die_handlers = stderr_handlers;
+static message_handler_func *warn_handlers = stderr_handlers;
+static message_handler_func *die_handlers = stderr_handlers;
/* If non-NULL, called before exit and its return value passed to exit. */
int (*message_fatal_cleanup)(void) = NULL;
@@ -145,16 +141,18 @@
* duplication since we can't assume variadic macros, but I can at least make
* it easier to write and keep them consistent.
*/
-#define HANDLER_FUNCTION(type) \
- void \
- message_handlers_ ## type(unsigned int count, ...) \
- { \
- va_list args; \
- \
- va_start(args, count); \
- message_handlers(& type ## _handlers, count, args); \
- va_end(args); \
+/* clang-format off */
+#define HANDLER_FUNCTION(type) \
+ void \
+ message_handlers_ ## type(unsigned int count, ...) \
+ { \
+ va_list args; \
+ \
+ va_start(args, count); \
+ message_handlers(& type ## _handlers, count, args); \
+ va_end(args); \
}
+/* clang-format on */
HANDLER_FUNCTION(debug)
HANDLER_FUNCTION(notice)
HANDLER_FUNCTION(warn)
@@ -255,7 +253,7 @@
CloseEventLog(eventlog);
}
}
-#else /* !_WIN32 */
+#else /* !_WIN32 */
if (err == 0)
syslog(pri, "%s", buffer);
else
@@ -269,6 +267,7 @@
* Do the same sort of wrapper to generate all of the separate syslog logging
* functions.
*/
+/* clang-format off */
#define SYSLOG_FUNCTION(name, type) \
void \
message_log_syslog_ ## name(size_t l, const char *f, va_list a, int e) \
@@ -281,6 +280,7 @@
SYSLOG_FUNCTION(warning, WARNING)
SYSLOG_FUNCTION(err, ERR)
SYSLOG_FUNCTION(crit, CRIT)
+/* clang-format on */
/*
Modified: lib/mkstemp.c
===================================================================
--- lib/mkstemp.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/mkstemp.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -26,7 +26,7 @@
#include <errno.h>
#include <fcntl.h>
#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
+# include <sys/time.h>
#endif
#include <time.h>
@@ -36,8 +36,8 @@
* another name.
*/
#if TESTING
-# undef mkstemp
-# define mkstemp test_mkstemp
+# undef mkstemp
+# define mkstemp test_mkstemp
int test_mkstemp(char *);
#endif
Modified: lib/network-innbind.c
===================================================================
--- lib/network-innbind.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/network-innbind.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -15,8 +15,8 @@
*/
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include <errno.h>
#ifdef HAVE_STREAMS_SENDFD
Modified: lib/network.c
===================================================================
--- lib/network.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/network.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -46,15 +46,15 @@
*/
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include <errno.h>
#ifdef HAVE_SYS_SELECT_H
-# include <sys/select.h>
+# include <sys/select.h>
#endif
#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
+# include <sys/time.h>
#endif
#include <time.h>
@@ -68,11 +68,11 @@
/* Macros to set the len attribute of sockaddrs. */
#if HAVE_STRUCT_SOCKADDR_SA_LEN
-# define sin_set_length(s) ((s)->sin_len = sizeof(struct sockaddr_in))
-# define sin6_set_length(s) ((s)->sin6_len = sizeof(struct sockaddr_in6))
+# define sin_set_length(s) ((s)->sin_len = sizeof(struct sockaddr_in))
+# define sin6_set_length(s) ((s)->sin6_len = sizeof(struct sockaddr_in6))
#else
-# define sin_set_length(s) /* empty */
-# define sin6_set_length(s) /* empty */
+# define sin_set_length(s) /* empty */
+# define sin6_set_length(s) /* empty */
#endif
/*
@@ -80,9 +80,9 @@
* return short writes on blocking sockets.
*/
#ifdef _WIN32
-# define socket_xwrite(fd, b, s) send((fd), (b), (s), 0)
+# define socket_xwrite(fd, b, s) send((fd), (b), (s), 0)
#else
-# define socket_xwrite(fd, b, s) xwrite((fd), (b), (s))
+# define socket_xwrite(fd, b, s) xwrite((fd), (b), (s))
#endif
@@ -600,8 +600,8 @@
* anything useful.
*/
socket_type
-network_connect_host(const char *host, unsigned short port,
- const char *source, time_t timeout)
+network_connect_host(const char *host, unsigned short port, const char *source,
+ time_t timeout)
{
struct addrinfo hints, *ai;
char portbuf[16];
@@ -979,7 +979,7 @@
return false;
return (a4.s_addr & addr_mask) == (b4.s_addr & addr_mask);
}
-
+
#ifdef HAVE_INET6
/*
* Otherwise, if the address is IPv6, the mask is required to be a CIDR
Modified: lib/reallocarray.c
===================================================================
--- lib/reallocarray.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/reallocarray.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -34,8 +34,8 @@
* it to another name.
*/
#if TESTING
-# undef reallocarray
-# define reallocarray test_reallocarray
+# undef reallocarray
+# define reallocarray test_reallocarray
void *test_reallocarray(void *, size_t, size_t);
#endif
Modified: lib/setenv.c
===================================================================
--- lib/setenv.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/setenv.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -29,8 +29,8 @@
* the system version.
*/
#if TESTING
-# undef setenv
-# define setenv test_setenv
+# undef setenv
+# define setenv test_setenv
int test_setenv(const char *, const char *, int);
#endif
Modified: lib/seteuid.c
===================================================================
--- lib/seteuid.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/seteuid.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -31,7 +31,7 @@
#include "config.h"
#if HAVE_UNISTD_H
-# include <unistd.h>
+# include <unistd.h>
#endif
int
Modified: lib/snprintf.c
===================================================================
--- lib/snprintf.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/snprintf.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -65,7 +65,7 @@
* probably requires libm on most operating systems. Don't yet
* support the exponent (e,E) and sigfig (g,G). Also, fmtint()
* was pretty badly broken, it just wasn't being exercised in ways
- * which showed it, so that's been fixed. Also, formated the code
+ * which showed it, so that's been fixed. Also, formatted the code
* to mutt conventions, and removed dead code left over from the
* original. Also, there is now a builtin-test, just compile with:
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
@@ -715,7 +715,7 @@
if (intpart != 0)
{
/* For each digit of INTPART, print one less fractional digit. */
- LLONG temp = intpart;
+ LLONG temp;
for (temp = intpart; temp != 0; temp /= 10)
--max;
if (max < 0)
Modified: lib/vector.c
===================================================================
--- lib/vector.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/vector.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -25,7 +25,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2001-2006, 2016 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2001-2006, 2016, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2005-2006, 2008-2011, 2013-2014
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -102,8 +102,8 @@
vector->count = size;
if (size == 0)
size = 1;
- vector->strings
- = xreallocarray(vector->strings, size, sizeof(const char *));
+ vector->strings =
+ xreallocarray(vector->strings, size, sizeof(const char *));
vector->allocated = size;
}
@@ -328,7 +328,7 @@
return 0;
/*
- * Walk the string looking for the first separator not preceeded by
+ * Walk the string looking for the first separator not preceded by
* another separator (and ignore a separator at the start of the string).
*/
for (count = 1, p = string + 1; *p != '\0'; p++)
@@ -351,8 +351,7 @@
* are considered a single separator. Reuse the provided vector if non-NULL.
*/
struct vector *
-vector_split_multi(const char *string, const char *seps,
- struct vector *vector)
+vector_split_multi(const char *string, const char *seps, struct vector *vector)
{
const char *p, *start;
size_t i, count;
@@ -550,7 +549,7 @@
if (vector->allocated == vector->count)
vector_resize(vector, vector->count + 1);
vector->strings[vector->count] = NULL;
- return execv(path, (char * const *) vector->strings);
+ return execv(path, (char *const *) vector->strings);
}
int
@@ -560,5 +559,5 @@
if (vector->allocated == vector->count)
cvector_resize(vector, vector->count + 1);
vector->strings[vector->count] = NULL;
- return execv(path, (char * const *) vector->strings);
+ return execv(path, (char *const *) vector->strings);
}
Modified: lib/xmalloc.c
===================================================================
--- lib/xmalloc.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/xmalloc.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -102,8 +102,8 @@
xmalloc_fail(const char *function, size_t size, const char *file, int line)
{
if (size == 0)
- sysdie("failed to format output with %s at %s line %d", function,
- file, line);
+ sysdie("failed to format output with %s at %s line %d", function, file,
+ line);
else
sysdie("failed to %s %lu bytes at %s line %d", function,
(unsigned long) size, file, line);
@@ -203,7 +203,7 @@
char *copy;
/* Don't assume that the source string is nul-terminated. */
- for (p = s; (size_t) (p - s) < size && *p != '\0'; p++)
+ for (p = s; (size_t)(p - s) < size && *p != '\0'; p++)
;
length = p - s;
copy = malloc(length + 1);
@@ -263,7 +263,7 @@
}
va_end(args);
}
-#else /* !(HAVE_C99_VAMACROS || HAVE_GNU_VAMACROS) */
+#else /* !(HAVE_C99_VAMACROS || HAVE_GNU_VAMACROS) */
void
x_asprintf(char **strp, const char *fmt, ...)
{
Modified: lib/xwrite.c
===================================================================
--- lib/xwrite.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ lib/xwrite.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -65,12 +65,12 @@
* and it's possible the other functions may be similarly affected.
*/
#if TESTING
-# undef pwrite
-# undef write
-# undef writev
-# define pwrite fake_pwrite
-# define write fake_write
-# define writev fake_writev
+# undef pwrite
+# undef write
+# undef writev
+# define pwrite fake_pwrite
+# define write fake_write
+# define writev fake_writev
ssize_t fake_pwrite(int, const void *, size_t, off_t);
ssize_t fake_write(int, const void *, size_t);
ssize_t fake_writev(int, const struct iovec *, int);
@@ -85,7 +85,7 @@
unsigned int count = 0;
if (size == 0)
- return 0;
+ return 0;
/* Abort the write if we try ten times with no forward progress. */
for (total = 0; total < size; total += status) {
@@ -113,7 +113,7 @@
unsigned int count = 0;
if (size == 0)
- return 0;
+ return 0;
/* Abort the write if we try ten times with no forward progress. */
for (total = 0; total < size; total += status) {
@@ -148,7 +148,7 @@
* writev to fail with an error we'll return.
*/
if (iovcnt == 0)
- return 0;
+ return 0;
if (iovcnt < 0 || (size_t) iovcnt > SIZE_MAX / sizeof(struct iovec)) {
errno = EINVAL;
return -1;
@@ -158,7 +158,7 @@
for (total = 0, i = 0; i < (unsigned int) iovcnt; i++)
total += iov[i].iov_len;
if (total == 0)
- return 0;
+ return 0;
/*
* First, try just writing it all out. Most of the time this will succeed
Modified: m4/cc-flags.m4
===================================================================
--- m4/cc-flags.m4 2020-03-04 20:16:44 UTC (rev 10355)
+++ m4/cc-flags.m4 2020-03-04 20:17:59 UTC (rev 10356)
@@ -8,7 +8,7 @@
dnl The canonical version of this file is maintained in the rra-c-util
dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
dnl
-dnl Copyright 2016-2019 Russ Allbery <eagle at eyrie.org>
+dnl Copyright 2016-2020 Russ Allbery <eagle at eyrie.org>
dnl Copyright 2006, 2009, 2016
dnl by Internet Systems Consortium, Inc. ("ISC")
dnl
@@ -30,7 +30,7 @@
AC_DEFUN([_INN_PROG_CC_FLAG_CACHE],
[translit([inn_cv_compiler_c_$1], [-=+], [___])])
-dnl Check whether a given flag is supported by the complier.
+dnl Check whether a given flag is supported by the compiler.
AC_DEFUN([INN_PROG_CC_FLAG],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING([if $CC supports $1])
Modified: tests/lib/buffer-t.c
===================================================================
--- tests/lib/buffer-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/buffer-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -6,7 +6,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2002-2004, 2006, 2014-2015 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2002-2004, 2006, 2014-2015, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2011-2014
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -65,8 +65,8 @@
int
main(void)
{
- struct buffer one = { 0, 0, 0, NULL };
- struct buffer two = { 0, 0, 0, NULL };
+ struct buffer one = {0, 0, 0, NULL};
+ struct buffer two = {0, 0, 0, NULL};
struct buffer *three;
int fd;
char *data;
@@ -80,7 +80,7 @@
is_int(1024, one.size, "minimum size is 1024");
is_int(0, one.used, "used starts at 0");
is_int(sizeof(test_string1), one.left, "left is correct");
- is_string(test_string1, one.data, "data is corect");
+ is_string(test_string1, one.data, "data is correct");
buffer_append(&one, test_string2, sizeof(test_string2));
is_int(1024, one.size, "appended data doesn't change size");
is_int(0, one.used, "or used");
@@ -96,7 +96,9 @@
ok(memcmp(one.data + one.used, test_string2, sizeof(test_string2)) == 0,
"and the middle data is unchanged");
ok(memcmp(one.data + one.used + sizeof(test_string2), test_string1,
- sizeof(test_string1)) == 0, "and the final data is correct");
+ sizeof(test_string1))
+ == 0,
+ "and the final data is correct");
buffer_set(&one, test_string1, sizeof(test_string1));
buffer_set(&two, test_string2, sizeof(test_string2));
buffer_swap(&one, &two);
Modified: tests/lib/fakewrite.c
===================================================================
--- tests/lib/fakewrite.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/fakewrite.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -36,8 +36,8 @@
#include <errno.h>
+#include "lib/fakewrite.h"
#include "inn/macros.h"
-#include "lib/fakewrite.h"
/*
@@ -105,7 +105,7 @@
errno = ENOSPC;
return -1;
}
- if ((size_t) (256 - offset) < total)
+ if ((size_t)(256 - offset) < total)
total = 256 - offset;
memcpy(write_buffer + offset, data, total);
return total;
Modified: tests/lib/fdflag-t.c
===================================================================
--- tests/lib/fdflag-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/fdflag-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -33,8 +33,8 @@
#define LIBTEST_NEW_FORMAT 1
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include <errno.h>
#include <sys/wait.h>
Modified: tests/lib/getaddrinfo-t.c
===================================================================
--- tests/lib/getaddrinfo-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/getaddrinfo-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -22,8 +22,8 @@
#define LIBTEST_NEW_FORMAT 1
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include "tap/basic.h"
@@ -33,12 +33,12 @@
* implementation.
*/
#if AI_NUMERICSERV == 0
-# undef AI_NUMERICSERV
-# define AI_NUMERICSERV 0x0080
+# undef AI_NUMERICSERV
+# define AI_NUMERICSERV 0x0080
#endif
#if AI_NUMERICHOST == 0
-# undef AI_NUMERICHOST
-# define AI_NUMERICHOST 0x0100
+# undef AI_NUMERICHOST
+# define AI_NUMERICHOST 0x0100
#endif
const char *test_gai_strerror(int);
@@ -108,8 +108,7 @@
"AI_NUMERICSERV with 25 smtp");
ok(test_getaddrinfo(NULL, "25 ", &hints, &ai) == EAI_NONAME,
"AI_NUMERICSERV with 25 space");
- ok(test_getaddrinfo(NULL, "25", &hints, &ai) == 0,
- "valid AI_NUMERICSERV");
+ ok(test_getaddrinfo(NULL, "25", &hints, &ai) == 0, "valid AI_NUMERICSERV");
saddr = (struct sockaddr_in *) (void *) ai->ai_addr;
is_int(htons(25), saddr->sin_port, "...right port");
is_int(htonl(0x7f000001UL), saddr->sin_addr.s_addr, "...right address");
Modified: tests/lib/getnameinfo-t.c
===================================================================
--- tests/lib/getnameinfo-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/getnameinfo-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -21,8 +21,8 @@
#define LIBTEST_NEW_FORMAT 1
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include "tap/basic.h"
#include "inn/xmalloc.h"
@@ -32,7 +32,7 @@
/* Linux doesn't provide EAI_OVERFLOW, so make up our own for testing. */
#ifndef EAI_OVERFLOW
-# define EAI_OVERFLOW 10
+# define EAI_OVERFLOW 10
#endif
int
@@ -107,14 +107,14 @@
is_int(0, status, "lookup with NI_NUMERICHOST");
is_string("10.20.30.40", node, "...and found correct IP address");
node[0] = '\0';
- status = test_getnameinfo(sa, sizeof(sin), node, 1, NULL, 0,
- NI_NUMERICHOST);
+ status =
+ test_getnameinfo(sa, sizeof(sin), node, 1, NULL, 0, NI_NUMERICHOST);
is_int(EAI_OVERFLOW, status, "EAI_OVERFLOW with one character");
- status = test_getnameinfo(sa, sizeof(sin), node, 11, NULL, 0,
- NI_NUMERICHOST);
+ status =
+ test_getnameinfo(sa, sizeof(sin), node, 11, NULL, 0, NI_NUMERICHOST);
is_int(EAI_OVERFLOW, status, "EAI_OVERFLOW with 11 characters");
- status = test_getnameinfo(sa, sizeof(sin), node, 12, NULL, 0,
- NI_NUMERICHOST);
+ status =
+ test_getnameinfo(sa, sizeof(sin), node, 12, NULL, 0, NI_NUMERICHOST);
is_int(0, status, "fits into 12 characters");
is_string("10.20.30.40", node, "...and found correct IP address");
Modified: tests/lib/inet_aton-t.c
===================================================================
--- tests/lib/inet_aton-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/inet_aton-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -6,7 +6,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2000-2001, 2004, 2017 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2000-2001, 2004, 2017, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2007-2009, 2011
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -21,8 +21,8 @@
#define LIBTEST_NEW_FORMAT 1
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include "tap/basic.h"
@@ -59,6 +59,8 @@
{
plan(92);
+ /* clang-format off */
+
test_addr( "0.0.0.0", 0);
test_addr( "127.0.0.000000", 0x7f000000U);
test_addr( "255.255.255.255", 0xffffffffU);
@@ -110,5 +112,7 @@
test_fail( "127..127");
test_fail( "de.ad.be.ef");
+ /* clang-format on */
+
return 0;
}
Modified: tests/lib/inet_ntoa-t.c
===================================================================
--- tests/lib/inet_ntoa-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/inet_ntoa-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -6,7 +6,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2000-2001, 2004, 2016-2017 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2000-2001, 2004, 2016-2017, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2006-2009, 2011
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -21,8 +21,8 @@
#define LIBTEST_NEW_FORMAT 1
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include "tap/basic.h"
@@ -44,11 +44,13 @@
{
plan(5);
+ /* clang-format off */
test_addr( "0.0.0.0", 0x0);
test_addr( "127.0.0.0", 0x7f000000U);
test_addr("255.255.255.255", 0xffffffffU);
test_addr("172.200.232.199", 0xacc8e8c7U);
test_addr( "1.2.3.4", 0x01020304U);
+ /* clang-format on */
return 0;
}
Modified: tests/lib/inet_ntop-t.c
===================================================================
--- tests/lib/inet_ntop-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/inet_ntop-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -6,7 +6,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005, 2017 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2005, 2017, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2006-2009, 2011
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -21,8 +21,8 @@
#define LIBTEST_NEW_FORMAT 1
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include <errno.h>
@@ -30,7 +30,7 @@
/* Some systems too old to have inet_ntop don't have EAFNOSUPPORT. */
#ifndef EAFNOSUPPORT
-# define EAFNOSUPPORT EDOM
+# define EAFNOSUPPORT EDOM
#endif
const char *test_inet_ntop(int, const void *, char *, socklen_t);
@@ -64,11 +64,13 @@
ok(test_inet_ntop(AF_INET, NULL, NULL, 11) == NULL, "NULL buffer");
is_int(ENOSPC, errno, "...with right errno");
+ /* clang-format off */
test_addr( "0.0.0.0", 0x0);
test_addr( "127.0.0.0", 0x7f000000U);
test_addr("255.255.255.255", 0xffffffffU);
test_addr("172.200.232.199", 0xacc8e8c7U);
test_addr( "1.2.3.4", 0x01020304U);
+ /* clang-format on */
return 0;
}
Modified: tests/lib/messages-t.c
===================================================================
--- tests/lib/messages-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/messages-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -6,7 +6,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2002, 2004-2005, 2015, 2017 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2002, 2004-2005, 2015, 2017, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2009-2012
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -57,7 +57,7 @@
warn("warning");
}
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
test2(void *data UNUSED)
{
die("fatal");
@@ -70,7 +70,7 @@
syswarn("permissions");
}
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
test4(void *data UNUSED)
{
errno = EACCES;
@@ -84,7 +84,7 @@
warn("warning");
}
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
test6(void *data UNUSED)
{
message_program_name = "test6";
@@ -99,7 +99,7 @@
syswarn("perms %d", 7);
}
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
test8(void *data UNUSED)
{
message_program_name = "test8";
@@ -113,7 +113,7 @@
return 10;
}
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
test9(void *data UNUSED)
{
message_fatal_cleanup = return10;
@@ -120,7 +120,7 @@
die("fatal");
}
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
test10(void *data UNUSED)
{
message_program_name = 0;
@@ -129,7 +129,7 @@
sysdie("fatal perm");
}
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
test11(void *data UNUSED)
{
message_program_name = "test11";
@@ -139,7 +139,7 @@
sysdie("fatal");
}
-static void __attribute__((__format__(printf, 2, 0)))
+__attribute__((__format__(printf, 2, 0))) static void
log_msg(size_t len, const char *format, va_list args, int error)
{
fprintf(stderr, "%lu %d ", (unsigned long) len, error);
@@ -154,7 +154,7 @@
warn("warning");
}
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
test13(void *data UNUSED)
{
message_handlers_die(1, log_msg);
@@ -169,7 +169,7 @@
syswarn("warning");
}
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
test15(void *data UNUSED)
{
message_handlers_die(2, log_msg, log_msg);
@@ -221,7 +221,7 @@
debug("baz");
}
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
test22(void *data UNUSED)
{
message_handlers_die(0);
@@ -228,15 +228,15 @@
die("hi mom!");
}
-static
-void test23(void *data UNUSED)
+static void
+test23(void *data UNUSED)
{
message_handlers_warn(0);
warn("this is a test");
}
-static
-void test24(void *data UNUSED)
+static void
+test24(void *data UNUSED)
{
notice("first");
message_handlers_notice(0);
@@ -308,7 +308,7 @@
is_function_output(test20, NULL, 0, "3 0 foo\n", "test20");
is_function_output(test21, NULL, 0, "test23: baz\n", "test21");
- /* Make sure that it's possible to turn off a message type entirely. */
+ /* Make sure that it's possible to turn off a message type entirely. */
is_function_output(test22, NULL, 1, "", "test22");
is_function_output(test23, NULL, 0, "", "test23");
is_function_output(test24, NULL, 0, "first\nthird\n", "test24");
Modified: tests/lib/network/addr-ipv4-t.c
===================================================================
--- tests/lib/network/addr-ipv4-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/network/addr-ipv4-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -6,7 +6,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005, 2013, 2016 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2005, 2013, 2016, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2009-2013
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -34,8 +34,8 @@
#define LIBTEST_NEW_FORMAT 1
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include "tap/basic.h"
#include "inn/network.h"
@@ -110,6 +110,7 @@
freeaddrinfo(ai);
/* Tests for network_addr_compare. */
+ /* clang-format off */
is_addr_compare(1, "127.0.0.1", "127.0.0.1", NULL);
is_addr_compare(0, "127.0.0.1", "127.0.0.2", NULL);
is_addr_compare(1, "127.0.0.1", "127.0.0.0", "31");
@@ -123,8 +124,10 @@
is_addr_compare(0, "129.0.0.0", "1.0.0.0", "1");
is_addr_compare(1, "129.0.0.0", "1.0.0.0", "0");
is_addr_compare(1, "129.0.0.0", "1.0.0.0", "0.0.0.0");
+ /* clang-format on */
/* Test some invalid addresses. */
+ /* clang-format off */
is_addr_compare(0, "fred", "fred", NULL);
is_addr_compare(0, "", "", NULL);
is_addr_compare(0, "", "", "0");
@@ -133,6 +136,7 @@
is_addr_compare(0, "127.0.0.1", "127.0.0.1", "1p");
is_addr_compare(0, "127.0.0.1", "127.0.0.1", "-1");
is_addr_compare(0, "127.0.0.1", "127.0.0.1", "33");
+ /* clang-format on */
/* Test setting various socket options. */
fd = socket(PF_INET, SOCK_STREAM, IPPROTO_IP);
Modified: tests/lib/network/addr-ipv6-t.c
===================================================================
--- tests/lib/network/addr-ipv6-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/network/addr-ipv6-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -6,7 +6,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005, 2013, 2016-2018 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2005, 2013, 2016-2018, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2009-2013
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -34,8 +34,8 @@
#define LIBTEST_NEW_FORMAT 1
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include <ctype.h>
@@ -136,6 +136,7 @@
freeaddrinfo(ai4);
/* Tests for network_addr_compare. */
+ /* clang-format off */
is_addr_compare(1, ipv6_addr, ipv6_addr, NULL);
is_addr_compare(1, ipv6_addr, ipv6_addr, "128");
is_addr_compare(1, ipv6_addr, ipv6_addr, "60");
@@ -152,6 +153,7 @@
is_addr_compare(0, "ffff::1", "7fff::1", "-1");
is_addr_compare(0, "ffff::1", "ffff::1", "-1");
is_addr_compare(0, "ffff::1", "ffff::1", "129");
+ /* clang-format on */
/* Test setting various socket options. */
fd = socket(PF_INET6, SOCK_STREAM, IPPROTO_IP);
Modified: tests/lib/network/client-t.c
===================================================================
--- tests/lib/network/client-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/network/client-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -6,7 +6,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005, 2013-2014, 2016-2019 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2005, 2013-2014, 2016-2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2009-2013
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -34,12 +34,12 @@
#define LIBTEST_NEW_FORMAT 1
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include <errno.h>
+#include <signal.h>
#include <sys/wait.h>
-#include <signal.h>
#include "tap/basic.h"
#include "inn/macros.h"
@@ -52,7 +52,7 @@
* and expects to always succeed on the connection, taking the source address
* to pass into network_client_create.
*/
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
client_create_writer(const char *source)
{
socket_type fd;
@@ -82,7 +82,7 @@
* sleeps for 10 seconds before sending another string so that timeouts can be
* tested. Meant to be run in a child process.
*/
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
client_delay_writer(const char *host)
{
socket_type fd;
@@ -105,7 +105,7 @@
* Used to test network_write. Connects, reads 64KB from the network, then
* sleeps before reading another 64KB. Meant to be run in a child process.
*/
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
client_delay_reader(const char *host)
{
char *buffer;
@@ -416,8 +416,7 @@
*/
socket_set_errno(0);
ok(network_write(c, buffer, 32 * 1024, 0), "network_write");
- ok(network_write(c, buffer, 32 * 1024, 1),
- "network_write with timeout");
+ ok(network_write(c, buffer, 32 * 1024, 1), "network_write with timeout");
/*
* A longer write cannot be completely absorbed before the client sleep,
Modified: tests/lib/network/server-t.c
===================================================================
--- tests/lib/network/server-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/network/server-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -6,7 +6,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2005, 2013, 2016-2018 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2005, 2013, 2016-2018, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2009-2013
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -34,12 +34,12 @@
#define LIBTEST_NEW_FORMAT 1
#include "config.h"
+#include "portable/socket.h"
#include "clibrary.h"
-#include "portable/socket.h"
#include <errno.h>
+#include <signal.h>
#include <sys/wait.h>
-#include <signal.h>
#include "tap/basic.h"
#include "inn/fdflag.h"
@@ -150,7 +150,7 @@
* localhost, from the given source address, containing a constant string.
* This also verifies that network_client_create works properly.
*/
-static void __attribute__((__noreturn__))
+__attribute__((__noreturn__)) static void
client_udp_writer(const char *source)
{
socket_type fd;
@@ -236,7 +236,7 @@
/*
- * A varient version of the server portion of the test. Takes an array of
+ * A variant version of the server portion of the test. Takes an array of
* sockets and the size of the sockets and accepts a connection on any of
* those sockets. Ensures that the client address information is stored
* correctly by checking that it is an IPv4 address. For skipping purposes,
@@ -432,9 +432,9 @@
client_writer("127.0.0.1", source_ipv4, true);
#ifdef HAVE_INET6
} else if (family == AF_INET6) {
-# ifdef IPV6_V6ONLY
+# ifdef IPV6_V6ONLY
client_writer("127.0.0.1", source_ipv4, false);
-# endif
+# endif
client_writer("::1", source_ipv6, true);
#endif
} else {
Modified: tests/lib/snprintf-t.c
===================================================================
--- tests/lib/snprintf-t.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/snprintf-t.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -6,7 +6,7 @@
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
* Written by Russ Allbery <eagle at eyrie.org>
- * Copyright 2000-2006, 2018 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2000-2006, 2018-2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2009-2010
* The Board of Trustees of the Leland Stanford Junior University
* Copyright 1995 Patrick Powell
@@ -31,7 +31,7 @@
* formats for easy testing.
*/
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2) || defined(__clang__)
-# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
/*
@@ -43,20 +43,12 @@
static const char string[] = "abcdefghijklmnopqrstuvwxyz0123456789";
+/* clang-format off */
+
static const char *const fp_formats[] = {
- "%-1.5f", "%1.5f", "%31.9f", "%10.5f", "% 10.5f", "%+22.9f",
- "%+4.9f", "%01.3f", "%3.1f", "%3.2f", "%.0f", "%.1f",
+ "%-1.5f", "%1.5f", "%31.6f", "%10.5f", "% 10.5f", "%+22.6f",
+ "%+4.6f", "%01.3f", "%3.1f", "%3.2f", "%.0f", "%.1f",
"%f",
-
- /* %e and %g formats aren't really implemented yet. */
-#if 0
- "%-1.5e", "%1.5e", "%31.9e", "%10.5e", "% 10.5e", "%+22.9e",
- "%+4.9e", "%01.3e", "%3.1e", "%3.2e", "%.0e", "%.1e",
- "%e",
- "%-1.5g", "%1.5g", "%31.9g", "%10.5g", "% 10.5g", "%+22.9g",
- "%+4.9g", "%01.3g", "%3.1g", "%3.2g", "%.0g", "%.1g",
- "%g",
-#endif
NULL
};
static const char *const int_formats[] = {
@@ -102,10 +94,12 @@
0
};
+/* clang-format on */
+
static void
-test_format(bool trunc, const char *expected, int count,
- const char *format, ...)
+test_format(bool trunc, const char *expected, int count, const char *format,
+ ...)
{
char buf[128];
int result;
@@ -127,12 +121,13 @@
long lcount;
char lgbuf[128];
- plan(8 +
- (18 + (ARRAY_SIZE(fp_formats) - 1) * ARRAY_SIZE(fp_nums)
- + (ARRAY_SIZE(int_formats) - 1) * ARRAY_SIZE(int_nums)
- + (ARRAY_SIZE(uint_formats) - 1) * ARRAY_SIZE(uint_nums)
- + (ARRAY_SIZE(llong_formats) - 1) * ARRAY_SIZE(llong_nums)
- + (ARRAY_SIZE(ullong_formats) - 1) * ARRAY_SIZE(ullong_nums)) * 2);
+ plan(8
+ + (18 + (ARRAY_SIZE(fp_formats) - 1) * ARRAY_SIZE(fp_nums)
+ + (ARRAY_SIZE(int_formats) - 1) * ARRAY_SIZE(int_nums)
+ + (ARRAY_SIZE(uint_formats) - 1) * ARRAY_SIZE(uint_nums)
+ + (ARRAY_SIZE(llong_formats) - 1) * ARRAY_SIZE(llong_nums)
+ + (ARRAY_SIZE(ullong_formats) - 1) * ARRAY_SIZE(ullong_nums))
+ * 2);
is_int(4, test_snprintf(NULL, 0, "%s", "abcd"), "simple string length");
is_int(2, test_snprintf(NULL, 0, "%d", 20), "number length");
@@ -159,8 +154,8 @@
string, -2.5);
test_format(true, "abcdefghij4444", 14, "%.10s%n%d", string, &count, 4444);
is_int(10, count, "correct output from %%n");
- test_format(true, "abcdefghijklmnopqrstuvwxyz01234", 36, "%n%s%ln",
- &count, string, &lcount);
+ test_format(true, "abcdefghijklmnopqrstuvwxyz01234", 36, "%n%s%ln", &count,
+ string, &lcount);
is_int(0, count, "correct output from two %%n");
is_int(31, lcount, "correct output from long %%ln");
test_format(true, "(null)", 6, "%s", (char *) NULL);
Modified: tests/lib/xmalloc.c
===================================================================
--- tests/lib/xmalloc.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/xmalloc.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -5,7 +5,7 @@
* The canonical version of this file is maintained in the rra-c-util package,
* which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
*
- * Copyright 2000-2001, 2006, 2017 Russ Allbery <eagle at eyrie.org>
+ * Copyright 2000-2001, 2006, 2017, 2020 Russ Allbery <eagle at eyrie.org>
* Copyright 2008, 2012-2014
* The Board of Trustees of the Leland Stanford Junior University
*
@@ -41,7 +41,7 @@
#include <ctype.h>
#include <errno.h>
#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
+# include <sys/time.h>
#endif
#include <time.h>
@@ -387,6 +387,7 @@
#endif
}
+ /* clang-format off */
switch (code) {
case 'c': exit(test_calloc(size) ? willfail : 1);
case 'm': exit(test_malloc(size) ? willfail : 1);
@@ -398,5 +399,7 @@
case 'v': exit(test_vasprintf(size) ? willfail : 1);
default: die("Unknown mode %c", argv[1][0]);
}
+ /* clang-format on */
+
exit(1);
}
Modified: tests/lib/xmalloc.t
===================================================================
--- tests/lib/xmalloc.t 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/lib/xmalloc.t 2020-03-04 20:17:59 UTC (rev 10356)
@@ -8,7 +8,8 @@
# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle at eyrie.org>
-# Copyright 2000-2001, 2006, 2014, 2016, 2019 Russ Allbery <eagle at eyrie.org>
+# Copyright 2000-2001, 2006, 2014, 2016, 2019-2020
+# Russ Allbery <eagle at eyrie.org>
# Copyright 2008-2010, 2012
# The Board of Trustees of the Leland Stanford Junior University
#
@@ -35,7 +36,7 @@
. "$C_TAP_SOURCE/tap/libtap.sh"
cd "$C_TAP_BUILD/lib"
-# Run an xmalloc test. Takes the description, the expectd exit status, the
+# Run an xmalloc test. Takes the description, the expected exit status, the
# output, and the arguments.
ok_xmalloc () {
local desc w_status w_output output status
Modified: tests/runtests.c
===================================================================
--- tests/runtests.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/runtests.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -94,9 +94,9 @@
/* Required for fdopen(), getopt(), and putenv(). */
#if defined(__STRICT_ANSI__) || defined(PEDANTIC)
-# ifndef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 500
-# endif
+# ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 500
+# endif
#endif
#include <ctype.h>
@@ -121,7 +121,7 @@
/* AIX 6.1 (and possibly later) doesn't have WCOREDUMP. */
#ifndef WCOREDUMP
-# define WCOREDUMP(status) ((unsigned)(status) & 0x80)
+# define WCOREDUMP(status) ((unsigned) (status) &0x80)
#endif
/*
@@ -130,9 +130,9 @@
* have.
*/
#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-# define STDOUT_FILENO 1
-# define STDERR_FILENO 2
+# define STDIN_FILENO 0
+# define STDOUT_FILENO 1
+# define STDERR_FILENO 2
#endif
/*
@@ -150,58 +150,50 @@
* $(abs_top_builddir) respectively.
*/
#ifndef C_TAP_SOURCE
-# define C_TAP_SOURCE NULL
+# define C_TAP_SOURCE NULL
#endif
#ifndef C_TAP_BUILD
-# define C_TAP_BUILD NULL
+# define C_TAP_BUILD NULL
#endif
/* Test status codes. */
-enum test_status {
- TEST_FAIL,
- TEST_PASS,
- TEST_SKIP,
- TEST_INVALID
-};
+enum test_status { TEST_FAIL, TEST_PASS, TEST_SKIP, TEST_INVALID };
/* Really, just a boolean, but this is more self-documenting. */
-enum test_verbose {
- CONCISE = 0,
- VERBOSE = 1
-};
+enum test_verbose { CONCISE = 0, VERBOSE = 1 };
/* Indicates the state of our plan. */
enum plan_status {
- PLAN_INIT, /* Nothing seen yet. */
- PLAN_FIRST, /* Plan seen before any tests. */
- PLAN_PENDING, /* Test seen and no plan yet. */
- PLAN_FINAL /* Plan seen after some tests. */
+ PLAN_INIT, /* Nothing seen yet. */
+ PLAN_FIRST, /* Plan seen before any tests. */
+ PLAN_PENDING, /* Test seen and no plan yet. */
+ PLAN_FINAL /* Plan seen after some tests. */
};
/* Error exit statuses for test processes. */
-#define CHILDERR_DUP 100 /* Couldn't redirect stderr or stdout. */
-#define CHILDERR_EXEC 101 /* Couldn't exec child process. */
-#define CHILDERR_STDIN 102 /* Couldn't open stdin file. */
-#define CHILDERR_STDERR 103 /* Couldn't open stderr file. */
+#define CHILDERR_DUP 100 /* Couldn't redirect stderr or stdout. */
+#define CHILDERR_EXEC 101 /* Couldn't exec child process. */
+#define CHILDERR_STDIN 102 /* Couldn't open stdin file. */
+#define CHILDERR_STDERR 103 /* Couldn't open stderr file. */
/* Structure to hold data for a set of tests. */
struct testset {
- char *file; /* The file name of the test. */
- char **command; /* The argv vector to run the command. */
- enum plan_status plan; /* The status of our plan. */
- unsigned long count; /* Expected count of tests. */
- unsigned long current; /* The last seen test number. */
- unsigned int length; /* The length of the last status message. */
- unsigned long passed; /* Count of passing tests. */
- unsigned long failed; /* Count of failing lists. */
- unsigned long skipped; /* Count of skipped tests (passed). */
- unsigned long allocated; /* The size of the results table. */
- enum test_status *results; /* Table of results by test number. */
- unsigned int aborted; /* Whether the set was aborted. */
- unsigned int reported; /* Whether the results were reported. */
- int status; /* The exit status of the test. */
- unsigned int all_skipped; /* Whether all tests were skipped. */
- char *reason; /* Why all tests were skipped. */
+ char *file; /* The file name of the test. */
+ char **command; /* The argv vector to run the command. */
+ enum plan_status plan; /* The status of our plan. */
+ unsigned long count; /* Expected count of tests. */
+ unsigned long current; /* The last seen test number. */
+ unsigned int length; /* The length of the last status message. */
+ unsigned long passed; /* Count of passing tests. */
+ unsigned long failed; /* Count of failing lists. */
+ unsigned long skipped; /* Count of skipped tests (passed). */
+ unsigned long allocated; /* The size of the results table. */
+ enum test_status *results; /* Table of results by test number. */
+ unsigned int aborted; /* Whether the set was aborted. */
+ unsigned int reported; /* Whether the results were reported. */
+ int status; /* The exit status of the test. */
+ unsigned int all_skipped; /* Whether all tests were skipped. */
+ char *reason; /* Why all tests were skipped. */
};
/* Structure to hold a linked list of test sets. */
@@ -249,9 +241,9 @@
/* Include the file name and line number in malloc failures. */
#define xcalloc(n, type) \
((type *) x_calloc((n), sizeof(type), __FILE__, __LINE__))
-#define xmalloc(size) ((char *) x_malloc((size), __FILE__, __LINE__))
-#define xstrdup(p) x_strdup((p), __FILE__, __LINE__)
-#define xstrndup(p, size) x_strndup((p), (size), __FILE__, __LINE__)
+#define xmalloc(size) ((char *) x_malloc((size), __FILE__, __LINE__))
+#define xstrdup(p) x_strdup((p), __FILE__, __LINE__)
+#define xstrndup(p, size) x_strndup((p), (size), __FILE__, __LINE__)
#define xreallocarray(p, n, type) \
((type *) x_reallocarray((p), (n), sizeof(type), __FILE__, __LINE__))
@@ -261,9 +253,9 @@
* (to avoid confusion with other macros).
*/
#ifndef __attribute__
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-# define __attribute__(spec) /* empty */
-# endif
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+# define __attribute__(spec) /* empty */
+# endif
#endif
/*
@@ -274,11 +266,11 @@
* variadic macro support.
*/
#if !defined(__attribute__) && !defined(__alloc_size__)
-# if defined(__GNUC__) && !defined(__clang__)
-# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
-# define __alloc_size__(spec, args...) /* empty */
-# endif
-# endif
+# if defined(__GNUC__) && !defined(__clang__)
+# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
+# define __alloc_size__(spec, args...) /* empty */
+# endif
+# endif
#endif
/*
@@ -288,7 +280,7 @@
* compilation context, but there's no push and pop available.
*/
#if !defined(__attribute__) && (defined(__llvm__) || defined(__clang__))
-# pragma GCC diagnostic ignored "-Wattributes"
+# pragma GCC diagnostic ignored "-Wattributes"
#endif
/* Declare internal functions that benefit from compiler attributes. */
@@ -418,8 +410,8 @@
len = strlen(s) + 1;
p = (char *) malloc(len);
if (p == NULL)
- sysdie("failed to strdup %lu bytes at %s line %d",
- (unsigned long) len, file, line);
+ sysdie("failed to strdup %lu bytes at %s line %d", (unsigned long) len,
+ file, line);
memcpy(p, s, len);
return p;
}
@@ -441,9 +433,9 @@
char *copy;
/* Don't assume that the source string is nul-terminated. */
- for (p = s; (size_t) (p - s) < size && *p != '\0'; p++)
+ for (p = s; (size_t)(p - s) < size && *p != '\0'; p++)
;
- len = (size_t) (p - s);
+ len = (size_t)(p - s);
copy = (char *) malloc(len + 1);
if (copy == NULL)
sysdie("failed to strndup %lu bytes at %s line %d",
@@ -541,7 +533,7 @@
static const char *
skip_whitespace(const char *p)
{
- while (isspace((unsigned char)(*p)))
+ while (isspace((unsigned char) (*p)))
p++;
return p;
}
@@ -554,7 +546,7 @@
static const char *
skip_non_whitespace(const char *p)
{
- while (*p != '\0' && !isspace((unsigned char)(*p)))
+ while (*p != '\0' && !isspace((unsigned char) (*p)))
p++;
return p;
}
@@ -789,8 +781,7 @@
* reported status.
*/
static void
-test_checkline(const char *line, struct testset *ts,
- enum test_verbose verbose)
+test_checkline(const char *line, struct testset *ts, enum test_verbose verbose)
{
enum test_status status = TEST_PASS;
const char *bail;
@@ -830,7 +821,7 @@
return;
/* If we haven't yet seen a plan, look for one. */
- if (ts->plan == PLAN_INIT && isdigit((unsigned char)(*line))) {
+ if (ts->plan == PLAN_INIT && isdigit((unsigned char) (*line))) {
if (!test_plan(line, ts, verbose))
return;
} else if (strncmp(line, "1..", 3) == 0) {
@@ -881,7 +872,7 @@
* Handle directives. We should probably do something more interesting
* with unexpected passes of todo tests.
*/
- while (isdigit((unsigned char)(*line)))
+ while (isdigit((unsigned char) (*line)))
line++;
line = skip_whitespace(line);
if (*line == '#') {
@@ -904,10 +895,17 @@
/* Good results. Increment our various counters. */
switch (status) {
- case TEST_PASS: ts->passed++; break;
- case TEST_FAIL: ts->failed++; break;
- case TEST_SKIP: ts->skipped++; break;
- case TEST_INVALID: break;
+ case TEST_PASS:
+ ts->passed++;
+ break;
+ case TEST_FAIL:
+ ts->failed++;
+ break;
+ case TEST_SKIP:
+ ts->skipped++;
+ break;
+ case TEST_INVALID:
+ break;
}
ts->current = current;
ts->results[current - 1] = status;
@@ -1254,7 +1252,7 @@
char *path = NULL;
const char *bases[3], *suffix, *base;
unsigned int i, j;
- const char *suffixes[3] = { "-t", ".t", "" };
+ const char *suffixes[3] = {"-t", ".t", ""};
/* Possible base directories. */
bases[0] = ".";
@@ -1617,8 +1615,7 @@
else
printf("Aborted %lu test sets", aborted);
printf(", passed %lu/%lu tests", passed, total);
- }
- else if (failed == 0)
+ } else if (failed == 0)
fputs("All tests successful", stdout);
else
printf("Failed %lu/%lu tests, %.2f%% okay", failed, total,
@@ -1632,8 +1629,8 @@
puts(".");
printf("Files=%u, Tests=%lu", count, total);
printf(", %.2f seconds", tv_diff(&end, &start));
- printf(" (%.2f usr + %.2f sys = %.2f CPU)\n",
- tv_seconds(&stats.ru_utime), tv_seconds(&stats.ru_stime),
+ printf(" (%.2f usr + %.2f sys = %.2f CPU)\n", tv_seconds(&stats.ru_utime),
+ tv_seconds(&stats.ru_stime),
tv_sum(&stats.ru_utime, &stats.ru_stime));
return (failed == 0 && aborted == 0);
}
Modified: tests/tap/basic.c
===================================================================
--- tests/tap/basic.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/tap/basic.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -46,9 +46,9 @@
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
-# include <direct.h>
+# include <direct.h>
#else
-# include <sys/stat.h>
+# include <sys/stat.h>
#endif
#include <sys/types.h>
#include <unistd.h>
@@ -116,8 +116,8 @@
/* Windows provides mkdir and rmdir under different names. */
#ifdef _WIN32
-# define mkdir(p, m) _mkdir(p)
-# define rmdir(p) _rmdir(p)
+# define mkdir(p, m) _mkdir(p)
+# define rmdir(p) _rmdir(p)
#endif
/*
@@ -132,7 +132,7 @@
* We can get the highest test count from testnum.
*/
static unsigned long _planned = 0;
-static unsigned long _failed = 0;
+static unsigned long _failed = 0;
/*
* Store the PID of the process that called plan() and only summarize
@@ -188,15 +188,15 @@
* print_desc, which has to be done in a macro. Assumes that format is the
* argument immediately before the variadic arguments.
*/
-#define PRINT_DESC(prefix, format) \
- do { \
- if (format != NULL) { \
- va_list args; \
- printf("%s", prefix); \
- va_start(args, format); \
- vprintf(format, args); \
- va_end(args); \
- } \
+#define PRINT_DESC(prefix, format) \
+ do { \
+ if (format != NULL) { \
+ va_list args; \
+ printf("%s", prefix); \
+ va_start(args, format); \
+ vprintf(format, args); \
+ va_end(args); \
+ } \
} while (0)
@@ -290,8 +290,8 @@
incomplete = 1;
else {
file->bufsize += BUFSIZ;
- file->buffer
- = breallocarray_type(file->buffer, file->bufsize, char);
+ file->buffer =
+ breallocarray_type(file->buffer, file->bufsize, char);
}
/*
@@ -591,7 +591,7 @@
if (success)
printf("ok %lu", testnum++);
else {
- diag(" left: %s", !!left ? "true" : "false");
+ diag(" left: %s", !!left ? "true" : "false");
diag("right: %s", !!right ? "true" : "false");
printf("not ok %lu", testnum++);
_failed++;
@@ -651,7 +651,7 @@
if (success)
printf("ok %lu", testnum++);
else {
- diag(" left: %s", left == NULL ? "(null)" : left);
+ diag(" left: %s", left == NULL ? "(null)" : left);
diag("right: %s", right == NULL ? "(null)" : right);
printf("not ok %lu", testnum++);
_failed++;
@@ -705,7 +705,7 @@
if (success)
printf("ok %lu", testnum++);
else {
- const unsigned char *left_c = (const unsigned char *) left;
+ const unsigned char *left_c = (const unsigned char *) left;
const unsigned char *right_c = (const unsigned char *) right;
for (i = 0; i < len; i++) {
@@ -869,7 +869,7 @@
p = calloc(n, size);
if (p == NULL)
- sysbail("failed to calloc %lu", (unsigned long)(n * size));
+ sysbail("failed to calloc %lu", (unsigned long) (n * size));
return p;
}
@@ -961,9 +961,9 @@
size_t length;
/* Don't assume that the source string is nul-terminated. */
- for (p = s; (size_t) (p - s) < n && *p != '\0'; p++)
+ for (p = s; (size_t)(p - s) < n && *p != '\0'; p++)
;
- length = (size_t) (p - s);
+ length = (size_t)(p - s);
copy = (char *) malloc(length + 1);
if (copy == NULL)
sysbail("failed to strndup %lu bytes", (unsigned long) length);
@@ -984,7 +984,7 @@
{
char *base;
char *path = NULL;
- const char *envs[] = { "C_TAP_BUILD", "C_TAP_SOURCE", NULL };
+ const char *envs[] = {"C_TAP_BUILD", "C_TAP_SOURCE", NULL};
int i;
for (i = 0; envs[i] != NULL; i++) {
Modified: tests/tap/basic.h
===================================================================
--- tests/tap/basic.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/tap/basic.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -34,9 +34,9 @@
#ifndef TAP_BASIC_H
#define TAP_BASIC_H 1
+#include <stdarg.h> /* va_list */
+#include <stddef.h> /* size_t */
#include <tap/macros.h>
-#include <stdarg.h> /* va_list */
-#include <stddef.h> /* size_t */
/*
* Used for iterating through arrays. ARRAY_SIZE returns the number of
@@ -44,8 +44,8 @@
* ARRAY_END returns a pointer to the element past the end (ISO C99 makes it
* legal to refer to such a pointer as long as it's never dereferenced).
*/
-#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
-#define ARRAY_END(array) (&(array)[ARRAY_SIZE(array)])
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
+#define ARRAY_END(array) (&(array)[ARRAY_SIZE(array)])
BEGIN_DECLS
@@ -103,8 +103,7 @@
__attribute__((__format__(printf, 2, 3)));
int okv(int success, const char *format, va_list args)
__attribute__((__format__(printf, 2, 0)));
-void skip(const char *reason, ...)
- __attribute__((__format__(printf, 1, 2)));
+void skip(const char *reason, ...) __attribute__((__format__(printf, 1, 2)));
/*
* Report the same status on, or skip, the next count tests. ok_block()
@@ -114,8 +113,8 @@
__attribute__((__format__(printf, 3, 4)));
void skip_block(unsigned long count, const char *reason, ...)
__attribute__((__format__(printf, 2, 3)));
+
#endif
-
/*
* Compare two values. Returns true if the test passes and false if it fails.
* is_bool takes an int since the bool type isn't fully portable yet, but
@@ -152,10 +151,8 @@
* diag(). Nul characters are not supported in these files and will result in
* truncated output.
*/
-void diag_file_add(const char *file)
- __attribute__((__nonnull__));
-void diag_file_remove(const char *file)
- __attribute__((__nonnull__));
+void diag_file_add(const char *file) __attribute__((__nonnull__));
+void diag_file_remove(const char *file) __attribute__((__nonnull__));
/* Allocate memory, reporting a fatal error with bail on failure. */
void *bcalloc(size_t, size_t)
@@ -191,8 +188,7 @@
* Create a temporary directory relative to C_TAP_BUILD and return the path.
* The returned path should be freed with test_tmpdir_free().
*/
-char *test_tmpdir(void)
- __attribute__((__malloc__, __warn_unused_result__));
+char *test_tmpdir(void) __attribute__((__malloc__, __warn_unused_result__));
void test_tmpdir_free(char *path);
/*
@@ -214,8 +210,7 @@
typedef void (*test_cleanup_func)(int, int);
typedef void (*test_cleanup_func_with_data)(int, int, void *);
-void test_cleanup_register(test_cleanup_func)
- __attribute__((__nonnull__));
+void test_cleanup_register(test_cleanup_func) __attribute__((__nonnull__));
void test_cleanup_register_with_data(test_cleanup_func_with_data, void *)
__attribute__((__nonnull__));
Modified: tests/tap/float.c
===================================================================
--- tests/tap/float.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/tap/float.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -36,9 +36,9 @@
/* Required for isnan() and isinf(). */
#if defined(__STRICT_ANSI__) || defined(PEDANTIC)
-# ifndef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 600
-# endif
+# ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 600
+# endif
#endif
#include <math.h>
@@ -62,8 +62,8 @@
* floating point implicit conversion from the isnan() and isinf() macros.
*/
#if defined(__llvm__) || defined(__clang__)
-# pragma clang diagnostic ignored "-Wconversion"
-# pragma clang diagnostic ignored "-Wdouble-promotion"
+# pragma clang diagnostic ignored "-Wconversion"
+# pragma clang diagnostic ignored "-Wdouble-promotion"
#endif
/*
@@ -91,8 +91,7 @@
va_start(args, format);
fflush(stderr);
- if ((isnan(left) && isnan(right))
- || is_equal_infinity(left, right)
+ if ((isnan(left) && isnan(right)) || is_equal_infinity(left, right)
|| fabs(left - right) <= epsilon) {
success = 1;
okv(1, format, args);
Modified: tests/tap/macros.h
===================================================================
--- tests/tap/macros.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/tap/macros.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -43,9 +43,9 @@
* the other attributes to work with GCC versions between 2.7 and 2.96.
*/
#ifndef __attribute__
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
-# define __attribute__(spec) /* empty */
-# endif
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
+# define __attribute__(spec) /* empty */
+# endif
#endif
/*
@@ -56,18 +56,18 @@
* variadic macro support.
*/
#if !defined(__attribute__) && !defined(__alloc_size__)
-# if defined(__GNUC__) && !defined(__clang__)
-# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
-# define __alloc_size__(spec, args...) /* empty */
-# endif
-# endif
+# if defined(__GNUC__) && !defined(__clang__)
+# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
+# define __alloc_size__(spec, args...) /* empty */
+# endif
+# endif
#endif
/* Suppress __warn_unused_result__ if gcc is too old. */
#if !defined(__attribute__) && !defined(__warn_unused_result__)
-# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
-# define __warn_unused_result__ /* empty */
-# endif
+# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
+# define __warn_unused_result__ /* empty */
+# endif
#endif
/*
@@ -77,7 +77,7 @@
* compilation context, but there's no push and pop available.
*/
#if !defined(__attribute__) && (defined(__llvm__) || defined(__clang__))
-# pragma GCC diagnostic ignored "-Wattributes"
+# pragma GCC diagnostic ignored "-Wattributes"
#endif
/* Used for unused parameters to silence gcc warnings. */
@@ -90,11 +90,11 @@
#undef BEGIN_DECLS
#undef END_DECLS
#ifdef __cplusplus
-# define BEGIN_DECLS extern "C" {
-# define END_DECLS }
+# define BEGIN_DECLS extern "C" {
+# define END_DECLS }
#else
-# define BEGIN_DECLS /* empty */
-# define END_DECLS /* empty */
+# define BEGIN_DECLS /* empty */
+# define END_DECLS /* empty */
#endif
#endif /* TAP_MACROS_H */
Modified: tests/tap/process.c
===================================================================
--- tests/tap/process.c 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/tap/process.c 2020-03-04 20:17:59 UTC (rev 10356)
@@ -49,11 +49,11 @@
#include <fcntl.h>
#include <signal.h>
#ifdef HAVE_SYS_SELECT_H
-# include <sys/select.h>
+# include <sys/select.h>
#endif
#include <sys/stat.h>
#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
+# include <sys/time.h>
#endif
#include <sys/wait.h>
#include <time.h>
@@ -64,7 +64,7 @@
/* May be defined by the build system. */
#ifndef PATH_FAKEROOT
-# define PATH_FAKEROOT ""
+# define PATH_FAKEROOT ""
#endif
/* How long to wait for the process to start in seconds. */
@@ -75,12 +75,12 @@
* everything required to stop the process and clean up after it.
*/
struct process {
- pid_t pid; /* PID of child process */
- char *pidfile; /* PID file to delete on process stop */
- char *tmpdir; /* Temporary directory for log file */
- char *logfile; /* Log file of process output */
- bool is_child; /* Whether we can waitpid for process */
- struct process *next; /* Next process in global list */
+ pid_t pid; /* PID of child process */
+ char *pidfile; /* PID file to delete on process stop */
+ char *tmpdir; /* Temporary directory for log file */
+ char *logfile; /* Log file of process output */
+ bool is_child; /* Whether we can waitpid for process */
+ struct process *next; /* Next process in global list */
};
/*
Modified: tests/tap/process.h
===================================================================
--- tests/tap/process.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/tap/process.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -63,8 +63,7 @@
* successfully, call bail, with the error message being the output from the
* program.
*/
-void run_setup(const char *const argv[])
- __attribute__((__nonnull__));
+void run_setup(const char *const argv[]) __attribute__((__nonnull__));
/*
* process_start starts a process in the background, returning an opaque data
Modified: tests/tap/string.h
===================================================================
--- tests/tap/string.h 2020-03-04 20:16:44 UTC (rev 10355)
+++ tests/tap/string.h 2020-03-04 20:17:59 UTC (rev 10356)
@@ -37,7 +37,7 @@
#include "config.h"
#include "tap/macros.h"
-#include <stdarg.h> /* va_list */
+#include <stdarg.h> /* va_list */
BEGIN_DECLS
More information about the inn-committers
mailing list