aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/macros.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/libmdsserver/macros.h118
1 files changed, 2 insertions, 116 deletions
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h
index 45412b9..26ef4c0 100644
--- a/src/libmdsserver/macros.h
+++ b/src/libmdsserver/macros.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,31 +22,15 @@
#include "config.h"
#include "macro-bits.h"
-#include <stdio.h>
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-#include <time.h>
-#include <stddef.h>
-#include <sys/socket.h>
-
/*
#include <pthread.h>
-#include <string.h>
#include <sys/types.h>
-#include <dirent.h>
-#include <stdlib.h>
*/
/* # pragma GCC diagnostic ignored "-Wpedantic" */
-/* CLOCK_MONOTONIC_RAW is a Linux-specific bug-fix */
-#ifndef CLOCK_MONOTONIC_RAW
-# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
-#endif
-
/* Define TEMP_FAILURE_RETRY if not defined, however
* this version does not return a value, it will hoever
* clear `errno` if no error occurs. */
@@ -64,48 +48,6 @@
#endif
-/* Ensure that all aliases for AF_UNIX are defined */
-#if !defined(AF_LOCAL) && !defined(AF_UNIX) && defined(AF_FILE)
-# define AF_LOCAL AF_FILE
-# define AF_UNIX AF_FILE
-#elif !defined(AF_LOCAL) && defined(AF_UNIX)
-# define AF_LOCAL AF_UNIX
-#elif defined(AF_LOCAL) && !defined(AF_UNIX)
-# define AF_UNIX AF_LOCAL
-#endif
-#if !defined(AF_FILE) && defined(AF_LOCAL)
-# define AF_FILE AF_LOCAL
-#endif
-
-/* Ensure that all aliases for PF_UNIX are defined */
-#if !defined(PF_LOCAL) && !defined(PF_UNIX) && defined(PF_FILE)
-# define PF_LOCAL PF_FILE
-# define PF_UNIX PF_FILE
-#elif !defined(PF_LOCAL) && defined(PF_UNIX)
-# define PF_LOCAL PF_UNIX
-#elif defined(PF_LOCAL) && !defined(PF_UNIX)
-# define PF_UNIX PF_LOCAL
-#endif
-#if !defined(PF_FILE) && defined(PF_LOCAL)
-# define PF_FILE PF_LOCAL
-#endif
-
-/* Ensure that all aliases for AF_NETLINK are defined */
-#if !defined(AF_NETLINK) && defined(AF_ROUTE)
-# define AF_NETLINK AF_ROUTE
-#elif defined(AF_NETLINK) && !defined(AF_ROUTE)
-# define AF_ROUTE AF_NETLINK
-#endif
-
-/* Ensure that all aliases for PF_NETLINK are defined */
-#if !defined(PF_NETLINK) && defined(PF_ROUTE)
-# define PF_NETLINK PF_ROUTE
-#elif defined(PF_NETLINK) && !defined(PF_ROUTE)
-# define PF_ROUTE PF_NETLINK
-#endif
-
-
-
/**
* Wrapper around `asprintf` that makes sure that first
* argument gets set to `NULL` on error and that zero is
@@ -223,28 +165,6 @@
/**
- * Return the maximum value of two values
- *
- * @param a One of the values
- * @param b The other one of the values
- * @return The maximum value
- */
-#define max(a, b)\
- ((a) < (b) ? (b) : (a))
-
-
-/**
- * Return the minimum value of two values
- *
- * @param a One of the values
- * @param b The other one of the values
- * @return The minimum value
- */
-#define min(a, b)\
- ((a) < (b) ? (a) : (b))
-
-
-/**
* Cast a buffer to another type and get the slot for an element
*
* @param buffer:char* The buffer
@@ -335,28 +255,6 @@
/**
- * Check whether two strings are equal
- *
- * @param a:const char* One of the strings
- * @param b:const char* The other of the strings
- * @return :int Whether the strings are equal
- */
-#define strequals(a, b)\
- (!strcmp(a, b))
-
-
-/**
- * Check whether a string starts with another string
- *
- * @param haystack:const char* The string to inspect
- * @param needle:const char* The string `haystack` should start with
- * @return :int Whether `haystack` starts with `needle`
- */
-#define startswith(haystack, needle)\
- (strstr(haystack, needle) == haystack)
-
-
-/**
* Set effective user and the effective group to the
* real user and the real group, respectively. If the
* group cannot be set, the user till not be set either.
@@ -664,7 +562,7 @@
/**
* `strdup` wrapper that returns whether the allocation was not successful
*
- * This macro was added because GCC 6.1.1 warns of `original` is known to
+ * This macro was added because GCC 6.1.1 warns if `original` is known to
* be nonnull, when using `xstrdup`.
*
* @param var:char* The variable to which to assign the duplicate
@@ -748,18 +646,6 @@
/**
- * The way to get a pointer to the end of a string
- *
- * `strchr(str, '\0')` is faster than `str + strlen(str)`,
- * at least in the GNU C Library. If this is not true for
- * the compiler you are using, you may want to edit this
- * macro.
- */
-#define STREND(str)\
- (strchr(str, '\0'))
-
-
-/**
* The system is running out of memory.
* Quick, free up all your unused memory or kill yourself!
*/