mirror of
https://github.com/privacore/open-source-search-engine.git
synced 2025-07-14 02:36:06 -04:00
Removed unused functions from UnicodeProperties.*
This commit is contained in:
@ -114,53 +114,7 @@ bool loadUnicodeTable(UCPropTable *table, const char *filename, bool useChecksum
|
||||
}
|
||||
|
||||
|
||||
bool setKDValue(UChar32 c, UChar32* decomp, int32_t decompCount, bool fullComp) {
|
||||
uint32_t size = sizeof(decompCount) +
|
||||
decompCount*sizeof(UChar32);
|
||||
|
||||
if (s_ucKDDataSize+size > s_ucKDAllocSize){
|
||||
if (!s_ucKDData) {
|
||||
s_ucKDData = (char*)mmalloc(4096,
|
||||
"UnicodeProperties");
|
||||
if (!s_ucKDData) {
|
||||
log(LOG_WARN, "uni: Out of Memory");
|
||||
return false;
|
||||
}
|
||||
s_ucKDAllocSize = 4096;
|
||||
//dummy value for 0 index
|
||||
*(int32_t*)s_ucKDData = 0xffffffff;
|
||||
s_ucKDDataSize = sizeof(int32_t);
|
||||
}
|
||||
else {
|
||||
uint32_t newSize = s_ucKDAllocSize + 4096;
|
||||
char *newBuf = (char*)mrealloc(s_ucKDData,
|
||||
s_ucKDAllocSize,
|
||||
newSize,
|
||||
"UnicodeProperties");
|
||||
if (!newBuf) {
|
||||
log(LOG_WARN, "uni: Out of Memory");
|
||||
return false;
|
||||
}
|
||||
s_ucKDAllocSize = newSize;
|
||||
s_ucKDData = newBuf;
|
||||
}
|
||||
|
||||
}
|
||||
// store fullComp flag in high bit of decompCount
|
||||
if (fullComp)
|
||||
*(int32_t*)(s_ucKDData+s_ucKDDataSize) = decompCount | 0x80000000;
|
||||
else
|
||||
*(int32_t*)(s_ucKDData+s_ucKDDataSize) = decompCount;
|
||||
|
||||
gbmemcpy(s_ucKDData+s_ucKDDataSize+sizeof(decompCount), decomp,
|
||||
decompCount*sizeof(UChar32));
|
||||
int32_t pos = s_ucKDDataSize;
|
||||
s_ucKDDataSize += size;
|
||||
|
||||
return g_ucKDIndex.setValue(c, (void*)&pos);
|
||||
}
|
||||
|
||||
const UChar32 *getKDValue(UChar32 c, int32_t *decompCount, bool *fullComp) {
|
||||
static const UChar32 *getKDValue(UChar32 c, int32_t *decompCount, bool *fullComp = NULL) {
|
||||
*decompCount = 0;
|
||||
if (fullComp) *fullComp = false;
|
||||
int32_t *pos = (int32_t*)g_ucKDIndex.getValue(c);
|
||||
|
@ -17,19 +17,12 @@ bool saveKDecompTable(const char *baseDir = NULL) ;
|
||||
bool loadDecompTables(const char *baseDir = NULL) ;
|
||||
void resetDecompTables() ;
|
||||
|
||||
bool setKDValue(UChar32 c, UChar32* decomp, int32_t decompCount,
|
||||
bool fullComp = false);
|
||||
const UChar32 *getKDValue(UChar32 c, int32_t *decompCount, bool *fullComp = NULL);
|
||||
int32_t recursiveKDExpand(UChar32 c, UChar32 *buf, int32_t bufSize);
|
||||
|
||||
|
||||
|
||||
static inline bool ucIsWhiteSpace(UChar32 c);
|
||||
static inline bool ucIsIdeograph(UChar32 c);
|
||||
static inline bool ucIsPunct(UChar32 c);
|
||||
static inline bool ucIsWordChar(UChar32 c);
|
||||
static inline bool ucIsIgnorable(UChar32 c);
|
||||
static inline bool ucIsExtend(UChar32 c);
|
||||
|
||||
|
||||
// Parse Properties
|
||||
@ -205,26 +198,6 @@ static inline bool ucIsWhiteSpace(UChar32 c) {
|
||||
return *(UCProps*)p & UC_WHITESPACE;
|
||||
}
|
||||
|
||||
static inline bool ucIsIdeograph(UChar32 c) {
|
||||
const void *p = g_ucProps.getValue(c);
|
||||
if (!p) return false;
|
||||
return *(UCProps*)p & UC_IDEOGRAPH;
|
||||
}
|
||||
|
||||
static inline bool ucIsPunct(UChar32 c) {
|
||||
return !ucIsWordChar(c);
|
||||
}
|
||||
|
||||
static inline bool ucIsIgnorable(UChar32 c) {
|
||||
const void *p = g_ucProps.getValue(c);
|
||||
if (!p) return false;
|
||||
return *(UCProps*)p & UC_IGNORABLE;
|
||||
}
|
||||
static inline bool ucIsExtend(UChar32 c) {
|
||||
const void *p = g_ucProps.getValue(c);
|
||||
if (!p) return false;
|
||||
return *(UCProps*)p & UC_EXTEND;
|
||||
}
|
||||
|
||||
|
||||
static inline UChar32 ucToLower(UChar32 c) {
|
||||
|
Reference in New Issue
Block a user