From f0e3aecbaae2895cd2beca1a6c1bf6bb96ff626e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=A9nainn=20Woodsend?= Date: Sat, 12 Feb 2022 10:23:27 +0000 Subject: [PATCH] Remove the hidden JSON_NO_EXTRA_WHITESPACE compile knob. Unsetting it can lead to seg-faults. I don't think it's worth having to fix and then test this undocumented permutation. --- lib/ultrajson.h | 3 --- lib/ultrajsonenc.c | 10 ---------- 2 files changed, 13 deletions(-) diff --git a/lib/ultrajson.h b/lib/ultrajson.h index c686bd04..13265836 100644 --- a/lib/ultrajson.h +++ b/lib/ultrajson.h @@ -56,9 +56,6 @@ tree doesn't have cyclic references. #include #include -// Don't output any extra whitespaces when encoding -#define JSON_NO_EXTRA_WHITESPACE - // Max decimals to encode double floating point numbers with #ifndef JSON_DOUBLE_MAX_DECIMALS #define JSON_DOUBLE_MAX_DECIMALS 15 diff --git a/lib/ultrajsonenc.c b/lib/ultrajsonenc.c index 2691d604..6f99ac46 100644 --- a/lib/ultrajsonenc.c +++ b/lib/ultrajsonenc.c @@ -679,14 +679,10 @@ static void encode(JSOBJ obj, JSONObjectEncoder *enc, const char *name, size_t c Buffer_AppendCharUnchecked(enc, '\"'); Buffer_AppendCharUnchecked (enc, ':'); -#ifdef JSON_NO_EXTRA_WHITESPACE if (enc->indent) { Buffer_AppendCharUnchecked (enc, ' '); } -#else - Buffer_AppendCharUnchecked (enc, ' '); -#endif } tc.encoder_prv = enc->prv; @@ -710,9 +706,6 @@ static void encode(JSOBJ obj, JSONObjectEncoder *enc, const char *name, size_t c if (count > 0) { Buffer_AppendCharUnchecked (enc, ','); -#ifndef JSON_NO_EXTRA_WHITESPACE - Buffer_AppendCharUnchecked (enc, ' '); -#endif } Buffer_AppendIndentNewlineUnchecked (enc); @@ -758,9 +751,6 @@ static void encode(JSOBJ obj, JSONObjectEncoder *enc, const char *name, size_t c if (count > 0) { Buffer_AppendCharUnchecked (enc, ','); -#ifndef JSON_NO_EXTRA_WHITESPACE - Buffer_AppendCharUnchecked (enc, ' '); -#endif } Buffer_AppendIndentNewlineUnchecked (enc);