Define feature test macros in common.h

This enables necessary functions once for all.

As a consequence, define common.h before any other header.
This commit is contained in:
Romain Vimont
2021-01-08 19:24:51 +01:00
parent 59feb2a15c
commit ab912c23e7
37 changed files with 77 additions and 53 deletions

View File

@@ -1,11 +1,11 @@
#ifndef BUFFER_UTIL_H
#define BUFFER_UTIL_H
#include "common.h"
#include <stdbool.h>
#include <stdint.h>
#include "common.h"
static inline void
buffer_write16be(uint8_t *buf, uint16_t value) {
buf[0] = value >> 8;

View File

@@ -2,11 +2,11 @@
#ifndef CBUF_H
#define CBUF_H
#include "common.h"
#include <stdbool.h>
#include <unistd.h>
#include "common.h"
// To define a circular buffer type of 20 ints:
// struct cbuf_int CBUF(int, 20);
//

View File

@@ -1,10 +1,11 @@
#ifndef LOCK_H
#define LOCK_H
#include "common.h"
#include <stdint.h>
#include <SDL2/SDL_mutex.h>
#include "common.h"
#include "log.h"
static inline void

View File

@@ -1,6 +1,8 @@
#ifndef NET_H
#define NET_H
#include "common.h"
#include <stdbool.h>
#include <stdint.h>
#include <SDL2/SDL_platform.h>
@@ -17,8 +19,6 @@
typedef int socket_t;
#endif
#include "common.h"
bool
net_init(void);

View File

@@ -1,10 +1,10 @@
#ifndef SC_PROCESS_H
#define SC_PROCESS_H
#include <stdbool.h>
#include "common.h"
#include <stdbool.h>
#ifdef _WIN32
// not needed here, but winsock2.h must never be included AFTER windows.h

View File

@@ -2,12 +2,12 @@
#ifndef QUEUE_H
#define QUEUE_H
#include "common.h"
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include "common.h"
// To define a queue type of "struct foo":
// struct queue_foo QUEUE(struct foo);
#define QUEUE(TYPE) { \

View File

@@ -1,11 +1,11 @@
#ifndef STRUTIL_H
#define STRUTIL_H
#include "common.h"
#include <stdbool.h>
#include <stddef.h>
#include "common.h"
// like strncpy, except:
// - it copies at most n-1 chars
// - the dest string is nul-terminated