From ec6873958584810d31b7bfc79a7024ac46c5a0b2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 6 May 2021 12:59:06 +0530 Subject: [PATCH] Make it harder to forget to redefine uthash_fatal --- kitty/disk-cache.c | 4 +--- kitty/glyph-cache.c | 6 +----- kitty/hyperlink.c | 4 +--- kitty/kitty-uthash.h | 11 +++++++++++ 4 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 kitty/kitty-uthash.h diff --git a/kitty/disk-cache.c b/kitty/disk-cache.c index 8f55721f0..95452fa0d 100644 --- a/kitty/disk-cache.c +++ b/kitty/disk-cache.c @@ -13,7 +13,7 @@ #include "disk-cache.h" #include "safe-wrappers.h" -#include "uthash.h" +#include "kitty-uthash.h" #include "loop-utils.h" #include "threading.h" #include "cross-platform-random.h" @@ -25,8 +25,6 @@ #ifdef HAS_SENDFILE #include #endif -#undef uthash_fatal -#define uthash_fatal(msg) fatal(msg) typedef struct { diff --git a/kitty/glyph-cache.c b/kitty/glyph-cache.c index fd86f9319..4d9b6cf9e 100644 --- a/kitty/glyph-cache.c +++ b/kitty/glyph-cache.c @@ -6,11 +6,7 @@ */ #include "glyph-cache.h" -#include "uthash.h" - - -#undef uthash_fatal -#define uthash_fatal(msg) fatal(msg) +#include "kitty-uthash.h" typedef struct SpritePosItem { diff --git a/kitty/hyperlink.c b/kitty/hyperlink.c index c46989816..9478927fa 100644 --- a/kitty/hyperlink.c +++ b/kitty/hyperlink.c @@ -6,14 +6,12 @@ */ #include "hyperlink.h" -#include "uthash.h" +#include "kitty-uthash.h" #include #define MAX_KEY_LEN 2048 #define MAX_ID_LEN 256 #define MAX_ADDS_BEFORE_GC 256 -#undef uthash_fatal -#define uthash_fatal(msg) fatal(msg) typedef struct { const char *key; diff --git a/kitty/kitty-uthash.h b/kitty/kitty-uthash.h new file mode 100644 index 000000000..5b4993fd4 --- /dev/null +++ b/kitty/kitty-uthash.h @@ -0,0 +1,11 @@ +/* + * Copyright (C) 2021 Kovid Goyal + * + * Distributed under terms of the GPL3 license. + */ + +#pragma once + +#include "data-types.h" +#define uthash_fatal(msg) fatal(msg) +#include "uthash.h"