From 7098d64500a5337791082be71b7d1818b316458b Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 25 May 2023 12:03:48 +0200 Subject: [PATCH] Remove excessive constant declarations When all .cc files are #included from a single master C++ file, repetitive constant definitions - although the constant value remains the same - makes MSVC error out. Besides, it is not a good practice to redefine same constant over and over again. It defies the main idea of constants: "define once, use many times". --- internal/cldutil_offline.cc | 2 -- internal/cldutil_shared.cc | 7 ------- internal/getonescriptspan.cc | 1 - 3 files changed, 10 deletions(-) diff --git a/internal/cldutil_offline.cc b/internal/cldutil_offline.cc index 4007ea6..5381405 100644 --- a/internal/cldutil_offline.cc +++ b/internal/cldutil_offline.cc @@ -20,8 +20,6 @@ #include "tote.h" #include -static const int kMinCJKUTF8CharBytes = 3; - //------------------------------------------------------------------------------ // Offline: used by mapreduce or table construction //------------------------------------------------------------------------------ diff --git a/internal/cldutil_shared.cc b/internal/cldutil_shared.cc index f111473..b883538 100644 --- a/internal/cldutil_shared.cc +++ b/internal/cldutil_shared.cc @@ -46,13 +46,6 @@ static const uint32 kWordMask0[4] = { 0xFFFFFFFF, 0x000000FF, 0x0000FFFF, 0x00FFFFFF }; -static const int kMinCJKUTF8CharBytes = 3; - -static const int kMinGramCount = 3; -static const int kMaxGramCount = 16; - -static const int UTFmax = 4; // Max number of bytes in a UTF-8 character - // Routines to access a hash table of pairs // Buckets have 4-byte wordhash for sizes < 32K buckets, but only diff --git a/internal/getonescriptspan.cc b/internal/getonescriptspan.cc index 0f53da6..6fcc55e 100644 --- a/internal/getonescriptspan.cc +++ b/internal/getonescriptspan.cc @@ -200,7 +200,6 @@ static const uint8 kTagParseTbl_0[] = { enum { - UTFmax = 4, // maximum bytes per rune Runesync = 0x80, // cannot represent part of a UTF sequence (<) Runeself = 0x80, // rune and UTF sequences are the same (<) Runeerror = 0xFFFD, // decoding error in UTF