Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -16,10 +16,12 @@ esac OBJCFLAGS="$OBJCFLAGS -fobjc-exceptions" BUILDSYS_SHARED_LIB + +AC_DEFINE(OF_CONFIG_H, 1, [Define so that we know we got our config.h]) AC_C_BIGENDIAN([AC_DEFINE(OF_BIG_ENDIAN, 1, [Whether we are big endian])]) AC_CHECK_HEADER(objc/runtime.h, [AC_DEFINE(HAVE_OBJC_RUNTIME_H, 1, [Whether we have objc/runtime.h])]) Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -7,12 +7,10 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ -#import - #import "OFObject.h" /** * The OFArray class provides a class for storing dynamically sized arrays. * If you plan to store large hunks of data, you should consider using Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -7,16 +7,17 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ +#import "config.h" + #import #import #import #import "OFArray.h" - #import "OFExceptions.h" #import "OFMacros.h" static size_t lastpagebyte = 0; Index: src/OFExceptions.h ================================================================== --- src/OFExceptions.h +++ src/OFExceptions.h @@ -7,11 +7,10 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ -#import #import "OFObject.h" /* FIXME: Exceptions should include which type of error occoured (fopen etc.) */ /** Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -8,12 +8,10 @@ * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import -#import - #import #import "OFObject.h" /** Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -10,12 +10,12 @@ */ #import "config.h" #import -#import #import + #import #import #import "OFFile.h" #import "OFExceptions.h" Index: src/OFHashes.h ================================================================== --- src/OFHashes.h +++ src/OFHashes.h @@ -7,12 +7,10 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ -#import - #import "OFObject.h" #define MD5_DIGEST_SIZE 16 #define SHA1_DIGEST_SIZE 20 Index: src/OFHashes.m ================================================================== --- src/OFHashes.m +++ src/OFHashes.m @@ -10,11 +10,10 @@ */ #import "config.h" #import -#import #import "OFHashes.h" #import "OFMacros.h" /******* Index: src/OFListObject.m ================================================================== --- src/OFListObject.m +++ src/OFListObject.m @@ -10,10 +10,11 @@ */ #import "config.h" #import + #import "OFListObject.h" @implementation OFListObject + newWithData: (void*)ptr { Index: src/OFMacros.h ================================================================== --- src/OFMacros.h +++ src/OFMacros.h @@ -6,13 +6,27 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#ifndef OF_CONFIG_H +#error "You need to have the objfw defines in your config.h and include it!" +#endif + +#ifdef __GNUC__ +#define OF_INLINE inline __attribute__((always_inline)) +#define OF_LIKELY(cond) __builtin_expect(!!(cond), 1) +#define OF_UNLIKELY(cond) __builtin_expect(!!(cond), 0) +#else +#define OF_INLINE inline +#define OF_LIKELY(cond) cond +#define OF_UNLIKELY(cond) cond +#endif #ifdef OF_BIG_ENDIAN -static inline void +static OF_INLINE void OF_BSWAP_V(uint8_t *buf, size_t len) { uint32_t t; while (len--) { @@ -26,13 +40,5 @@ #define OF_BSWAP_V(buf, len) #endif #define OF_ROL(val, bits) \ (((val) << (bits)) | ((val) >> (32 - (bits)))) - -#ifdef __GNUC__ -#define OF_LIKELY(cond) __builtin_expect(!!(cond), 1) -#define OF_UNLIKELY(cond) __builtin_expect(!!(cond), 0) -#else -#define OF_LIKELY(cond) cond -#define OF_UNLIKELY(cond) cond -#endif Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -8,10 +8,11 @@ * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import + #import /** * The OFObject class is the base class for all other classes inside ObjFW. */ Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -8,11 +8,10 @@ * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import -#import #import "OFObject.h" /** * A class for storing and modifying strings. Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -11,11 +11,10 @@ #import "config.h" #import #import - #import #import #import "OFString.h" #import "OFExceptions.h" Index: src/OFXMLFactory.h ================================================================== --- src/OFXMLFactory.h +++ src/OFXMLFactory.h @@ -7,11 +7,11 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ -#import "wchar.h" +#import #import "OFObject.h" /** * The OFXMLFactory class provides an easy way to create XML stanzas. Index: src/OFXMLFactory.m ================================================================== --- src/OFXMLFactory.m +++ src/OFXMLFactory.m @@ -7,14 +7,16 @@ * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ +#import "config.h" + #import -#import #import #import +#import #import "OFXMLFactory.h" #import "OFExceptions.h" #import "OFMacros.h" Index: tests/OFArray/Makefile ================================================================== --- tests/OFArray/Makefile +++ tests/OFArray/Makefile @@ -1,11 +1,11 @@ PROG_NOINST = ofarray SRCS = OFArray.m include ../../buildsys.mk -CPPFLAGS += -I../../src +CPPFLAGS += -I../../src -I../.. LIBS += -lobjc -L../../src -lobjfw .PHONY: run all: run Index: tests/OFArray/OFArray.m ================================================================== --- tests/OFArray/OFArray.m +++ tests/OFArray/OFArray.m @@ -6,10 +6,12 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #import #import #import Index: tests/OFHashes/Makefile ================================================================== --- tests/OFHashes/Makefile +++ tests/OFHashes/Makefile @@ -1,11 +1,11 @@ PROG_NOINST = ofhashes SRCS = OFHashes.m include ../../buildsys.mk -CPPFLAGS += -I../../src +CPPFLAGS += -I../../src -I../.. LIBS += -lobjc -L../../src -lobjfw .PHONY: run all: run Index: tests/OFHashes/OFHashes.m ================================================================== --- tests/OFHashes/OFHashes.m +++ tests/OFHashes/OFHashes.m @@ -6,10 +6,12 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #import #import #import "OFHashes.h" Index: tests/OFList/Makefile ================================================================== --- tests/OFList/Makefile +++ tests/OFList/Makefile @@ -1,11 +1,11 @@ PROG_NOINST = oflist SRCS = OFList.m include ../../buildsys.mk -CPPFLAGS += -I../../src +CPPFLAGS += -I../../src -I../.. LIBS += -lobjc -L../../src -lobjfw .PHONY: run all: run Index: tests/OFList/OFList.m ================================================================== --- tests/OFList/OFList.m +++ tests/OFList/OFList.m @@ -6,12 +6,15 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #define _ISOC99_SOURCE + #import #import #import "OFString.h" #import "OFList.h" Index: tests/OFObject/Makefile ================================================================== --- tests/OFObject/Makefile +++ tests/OFObject/Makefile @@ -1,11 +1,11 @@ PROG_NOINST = ofobject SRCS = OFObject.m include ../../buildsys.mk -CPPFLAGS += -I../../src +CPPFLAGS += -I../../src -I../.. LIBS += -lobjc -L../../src -lobjfw .PHONY: run all: run Index: tests/OFObject/OFObject.m ================================================================== --- tests/OFObject/OFObject.m +++ tests/OFObject/OFObject.m @@ -6,10 +6,12 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #import #import #import "OFObject.h" Index: tests/OFString/Makefile ================================================================== --- tests/OFString/Makefile +++ tests/OFString/Makefile @@ -1,11 +1,11 @@ PROG_NOINST = ofstring SRCS = OFString.m include ../../buildsys.mk -CPPFLAGS += -I../../src +CPPFLAGS += -I../../src -I../.. LIBS += -lobjc -L../../src -lobjfw .PHONY: run all: run Index: tests/OFString/OFString.m ================================================================== --- tests/OFString/OFString.m +++ tests/OFString/OFString.m @@ -6,10 +6,12 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #import #import #import "OFString.h" Index: tests/OFXMLFactory/Makefile ================================================================== --- tests/OFXMLFactory/Makefile +++ tests/OFXMLFactory/Makefile @@ -1,11 +1,11 @@ PROG_NOINST = ofxmlfactory SRCS = OFXMLFactory.m include ../../buildsys.mk -CPPFLAGS += -I../../src +CPPFLAGS += -I../../src -I../.. LIBS += -lobjc -L../../src -lobjfw .PHONY: run all: run Index: tests/OFXMLFactory/OFXMLFactory.m ================================================================== --- tests/OFXMLFactory/OFXMLFactory.m +++ tests/OFXMLFactory/OFXMLFactory.m @@ -6,12 +6,15 @@ * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ + +#import "config.h" #define _ISOC99_SOURCE + #import #import #import #import "OFXMLFactory.h"