diff options
author | Christopher Haster <chaster@utexas.edu> | 2018-02-22 22:34:10 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2018-02-22 22:39:24 +0300 |
commit | 1476181bd17b4d9998b618f115fe64f3b86af0a5 (patch) | |
tree | c1df96a6b4923d47bd3484196817466db7370477 /lfs_util.h | |
parent | b2124a5ae54717737f6d96cb24e6f31e02158d1e (diff) |
Added LFS_CONFIG for user provided configuration of the utils
Suggested by sn00pster, LFS_CONFIG is an opt-in user provided
configuration file that will override the util implementation in
lfs_util.h. This is useful for allowing system-specific overrides
without needing to rely on git merges or other forms of patching
for updates.
Diffstat (limited to 'lfs_util.h')
-rw-r--r-- | lfs_util.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -18,6 +18,19 @@ #ifndef LFS_UTIL_H #define LFS_UTIL_H +// Users can override lfs_util.h with their own configuration by defining +// LFS_CONFIG as a header file to include (-DLFS_CONFIG=lfs_config.h). +// +// If LFS_CONFIG is used, none of the default utils will be emitted and must be +// provided by the config file. To start I would suggest copying lfs_util.h and +// modifying as needed. +#ifdef LFS_CONFIG +#define LFS_STRINGIZE(x) LFS_STRINGIZE2(x) +#define LFS_STRINGIZE2(x) #x +#include LFS_STRINGIZE(LFS_CONFIG) +#else + +// System includes #include <stdint.h> #include <stdbool.h> #include <string.h> @@ -169,3 +182,4 @@ static inline void lfs_free(void *p) { #endif +#endif |