#ifndef FIRM_COMPILER_H
#define FIRM_COMPILER_H
-/**
- * Asserts that the constant expression x is not zero at compiletime. name has
- * to be a unique identifier.
- *
- * @note This uses the fact, that double case labels are not allowed.
- */
-#define COMPILETIME_ASSERT(x, name) \
- static __attribute__((unused)) void compiletime_assert_##name (int h) { \
- switch(h) { case 0: case (x): {} } \
- }
-
#ifdef __GNUC__
/**
* Indicates to the compiler that the value of x is very likely 1
*/
#define PURE __attribute__((const))
+/**
+ * Tell the compiler, that a function is unused, no warning needed.
+ */
+#define UNUSED __attribute__((unused))
+
#else
#define LIKELY(x) x
#define UNLIKELY(x) x
#define PURE
+#define UNUSED
#endif
+/**
+ * Asserts that the constant expression x is not zero at compiletime. name has
+ * to be a unique identifier.
+ *
+ * @note This uses the fact, that double case labels are not allowed.
+ */
+#define COMPILETIME_ASSERT(x, name) \
+ static UNUSED void compiletime_assert_##name (int h) { \
+ switch(h) { case 0: case (x): {} } \
+ }
+
#endif
* Copyright (C) 2005 Universitaet Karlsruhe
* Released under the GPL
*/
-
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
-
-#define vsnprintf _vsnprintf
-
#else
#include <unistd.h>
#include <sys/types.h>
#include <arpa/inet.h>
#endif
+#include "config.h"
+
#include "irtools.h"
#include "debug.h"
* Try to read some bytes but block until a certain amount is read.
* @param fd The file descriptor.
* @param buf The buffer to read into.
- * @param try The amount of bytes to try to read.
+ * @param try_amount The amount of bytes to try to read.
* @param at_least block until this many bytes are read.
* @return The number of bytes read or -1 on error.
*/
-static ssize_t secure_recv(int fd, void *buf, size_t try, size_t at_least)
+static ssize_t secure_recv(int fd, void *buf, size_t try_amount, size_t at_least)
{
ssize_t res;
size_t bytes_read = 0;
char *data = buf;
do {
- res = recv(fd, &data[bytes_read], try - bytes_read, 0);
+ res = recv(fd, &data[bytes_read], try_amount - bytes_read, 0);
if(res <= 0) {
if(res == 0 || errno != EAGAIN)
return -1;
#include <stdarg.h>
#include <stdint.h>
+#ifdef _WIN32
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#endif
+
#define LPP_PORT 2175
#define LPP_BUFSIZE (1 << 20)