From 39dce2065ce5b6b8de5d52d788effe70372e6d47 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Thu, 31 Mar 2022 15:31:34 +0200 Subject: Some unneeded strictness removed in template.h --- include/stc/alt/cstr.h | 2 +- include/stc/cstr.h | 2 +- include/stc/forward.h | 2 +- include/stc/template.h | 20 ++++++++++++-------- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/stc/alt/cstr.h b/include/stc/alt/cstr.h index 536cd10e..5d84f538 100644 --- a/include/stc/alt/cstr.h +++ b/include/stc/alt/cstr.h @@ -26,7 +26,7 @@ */ #ifndef CSTR_H_INCLUDED #define CSTR_H_INCLUDED -#define CSTR_USE_SSO +#define STC_USE_SSO 1 #include #include diff --git a/include/stc/cstr.h b/include/stc/cstr.h index 5ffd09bf..189fc467 100644 --- a/include/stc/cstr.h +++ b/include/stc/cstr.h @@ -21,7 +21,7 @@ * SOFTWARE. */ -#ifdef CSTR_USE_SSO +#ifdef STC_USE_SSO #include "alt/cstr.h" #else #ifndef CSTR_H_INCLUDED diff --git a/include/stc/forward.h b/include/stc/forward.h index 5dae64c6..06ec3897 100644 --- a/include/stc/forward.h +++ b/include/stc/forward.h @@ -44,7 +44,7 @@ typedef struct { char* data; size_t size, cap; } cstr_rep_t; typedef char cstr_value; -#ifdef CSTR_USE_SSO +#ifdef STC_USE_SSO typedef union { struct { char data[sizeof(cstr_rep_t) - 1]; uint8_t last; } sso; struct { char* data; size_t size, ncap; } lon; diff --git a/include/stc/template.h b/include/stc/template.h index 269957f5..6e058f19 100644 --- a/include/stc/template.h +++ b/include/stc/template.h @@ -93,8 +93,8 @@ #endif #endif -#if defined i_keyraw && !(defined i_keyto && defined i_keyfrom) - #error "if i_keyraw defined, i_keyfrom and i_keyto must be defined" +#if defined i_keyraw && !defined i_keyfrom + #error "if i_keyraw defined, i_keyfrom (and often i_keyto) must be defined" #endif /* Resolve i_drop and i_from here */ @@ -146,8 +146,8 @@ #endif #endif -#if defined i_valraw && !(defined i_valto && defined i_valfrom) - #error "if i_valraw defined, i_valfrom and i_valto must be defined" +#if defined i_valraw && !defined i_valfrom + #error "if i_valraw defined, i_valfrom (and often i_valto) must be defined" #endif #ifdef i_key @@ -158,11 +158,13 @@ #define i_tag i_key #endif #if !defined i_keyfrom + #define _i_no_keyraw #define i_keyfrom c_default_from #endif #ifndef i_keyraw - #define _i_no_keyraw #define i_keyraw i_key + #endif + #ifndef i_keyto #define i_keyto c_default_toraw #endif #ifndef i_keydrop @@ -176,13 +178,15 @@ #define i_tag i_val #endif #if !defined i_valfrom - #define i_valfrom c_default_from -#endif -#ifndef i_valraw #if !defined i_key || defined _i_no_keyraw #define _i_no_raw #endif + #define i_valfrom c_default_from +#endif +#ifndef i_valraw #define i_valraw i_val +#endif +#ifndef i_valto #define i_valto c_default_toraw #endif #ifndef i_valdrop -- cgit v1.2.3