diff options
Diffstat (limited to 'src/serd_internal.h')
-rw-r--r-- | src/serd_internal.h | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/serd_internal.h b/src/serd_internal.h index f06c7051..911d296f 100644 --- a/src/serd_internal.h +++ b/src/serd_internal.h @@ -17,57 +17,14 @@ #ifndef SERD_INTERNAL_H #define SERD_INTERNAL_H -#define _POSIX_C_SOURCE 200809L /* for posix_memalign and posix_fadvise */ - -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - #include "serd/serd.h" #include "serd_config.h" -#include "world.h" - -#if defined(HAVE_FILENO) -# include <fcntl.h> -#endif - #define NS_XSD "http://www.w3.org/2001/XMLSchema#" #define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" -#define SERD_PAGE_SIZE 4096 - #ifndef MIN # define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif -/** fread-like wrapper for getc (which is faster). */ -static inline size_t -serd_file_read_byte(void* buf, size_t size, size_t nmemb, void* stream) -{ - (void)size; - (void)nmemb; - - const int c = getc((FILE*)stream); - if (c == EOF) { - *((uint8_t*)buf) = 0; - return 0; - } - *((uint8_t*)buf) = (uint8_t)c; - return 1; -} - -static inline void* -serd_bufalloc(size_t size) -{ -#ifdef HAVE_POSIX_MEMALIGN - void* ptr; - const int ret = posix_memalign(&ptr, SERD_PAGE_SIZE, size); - return ret ? NULL : ptr; -#else - return malloc(size); -#endif -} - #endif // SERD_INTERNAL_H |