Merge branch 'master' into nomerge2

This commit is contained in:
Ivan Skytte Jørgensen
2016-08-23 11:08:43 +02:00
5 changed files with 29 additions and 34 deletions

@ -178,7 +178,6 @@ public:
private:
PoolThreadParameters ptp;
std::vector<pthread_t> tid;
job_done_notify_t job_done_notify;
};

14
Mem.cpp

@ -310,7 +310,10 @@ void Mem::addMem ( void *mem , int32_t size , const char *note , char isnew ) {
if ( g_conf.m_logDebugMem ) printBreeches_unlocked();
// copy the magic character, iff not a new() call
if ( size == 0 ) gbshutdownLogicError();
if ( size == 0 ) {
sl.unlock();
gbshutdownLogicError();
}
// sanity check
if ( size < 0 ) {
log("mem: addMem: Negative size.");
@ -323,6 +326,7 @@ void Mem::addMem ( void *mem , int32_t size , const char *note , char isnew ) {
"%08" PTRFMT" of size %" PRId32" "
"which would wrap. Bad kernel.",
(PTRTYPE)mem,(int32_t)size);
sl.unlock();
gbshutdownLogicError();
}
@ -394,6 +398,7 @@ void Mem::addMem ( void *mem , int32_t size , const char *note , char isnew ) {
s_labels[h*16+3],
s_labels[h*16+4],
s_labels[h*16+5] );
sl.unlock();
gbshutdownAbort(true);
}
h++;
@ -401,6 +406,7 @@ void Mem::addMem ( void *mem , int32_t size , const char *note , char isnew ) {
if ( --count == 0 ) {
log( LOG_ERROR, "mem: addMem: Mem table is full.");
printMem();
sl.unlock();
gbshutdownResourceError();
}
}
@ -656,6 +662,7 @@ bool Mem::rmMem ( void *mem , int32_t size , const char *note ) {
// if not found, bitch
if ( ! s_mptrs[h] ) {
log( LOG_ERROR, "mem: rmMem: Unbalanced free. note=%s size=%" PRId32".",note,size);
sl.unlock();
gbshutdownLogicError();
}
@ -664,7 +671,10 @@ bool Mem::rmMem ( void *mem , int32_t size , const char *note ) {
// set our size
if ( size == -1 ) size = s_sizes[h];
// must be legit now
if ( size <= 0 ) gbshutdownLogicError();
if ( size <= 0 ) {
sl.unlock();
gbshutdownLogicError();
}
// . bitch is sizes don't match
// . delete operator does not provide a size now (it's -1)
if ( s_sizes[h] != size ) {

@ -392,8 +392,8 @@ bool Msg5::readList ( ) {
m_newMinRecSizes , // modified by gotList()
m_startFileNum ,
m_numFiles ,
this ,
gotListWrapper ,
NULL , // state
NULL , // callback
niceness ,
0 , // retry num
m_maxRetries , // -1=def

@ -9851,8 +9851,6 @@ char **XmlDoc::getRawUtf8Content ( ) {
log("build: xml: not enough memory for utf8 buffer");
return NULL;
}
// sanity check
if ( ! csName ) { g_process.shutdownAbort(true); }
// note it
setStatus ( "converting doc to utf8" );
// returns # of bytes i guess

42
hash.h

@ -30,20 +30,9 @@ uint32_t hash32n ( const char *s ) ;
uint32_t hash32 ( const char *s, int32_t len,uint32_t startHash=0);
uint32_t hash32h ( uint32_t h1 , uint32_t h2 ) ;
uint64_t hash64h ( uint64_t h1 , uint64_t h2 );
uint32_t hash32Fast ( uint32_t h1 , uint32_t h2 ) ;
uint32_t hash32Lower_a ( const char *s, int32_t len,uint32_t startHash=0);
uint64_t hash64n ( const char *s, uint64_t startHash =0LL);
uint64_t hash64 ( uint64_t h1,uint64_t h2);
uint64_t hash64 ( const char *s,int32_t len,uint64_t startHash=0);
uint64_t hash64_cont ( const char *s, int32_t len, uint64_t startHash, int32_t *conti);
uint64_t hash64b ( const char *s, uint64_t startHash = 0);
uint64_t hash64Lower_a ( const char *s, int32_t len, uint64_t startHash = 0 );
uint64_t hash64Lower_utf8 ( const char *s, int32_t len, uint64_t startHash = 0 );
uint64_t hash64Lower_utf8_nospaces ( const char *s, int32_t len );
uint64_t hash64Lower_utf8 ( const char *p );
uint64_t hash64Lower_utf8_cont ( const char *p, int32_t len, uint64_t startHash, int32_t *conti );
uint96_t hash96 ( const char *s, int32_t slen);
uint32_t hashLong ( uint32_t x ) ;
// . these convert \n to \0 when hashing
// . these hash all punct as a space, except for hyphen and single quote!
@ -51,10 +40,9 @@ uint32_t hashLong ( uint32_t x ) ;
// . these only take utf8 strings
uint64_t hash64d ( const char *s, int32_t slen );
uint64_t hash64Upper_a ( const char *s, int32_t len, uint64_t startHash = 0 );
inline uint64_t hash64b ( const char *s , uint64_t startHash ) {
static inline uint64_t hash64b ( const char *s , uint64_t startHash = 0) {
uint64_t h = startHash;
int32_t i = 0;
while ( s[i] ) {
@ -64,8 +52,8 @@ inline uint64_t hash64b ( const char *s , uint64_t startHash ) {
return h;
}
inline uint64_t hash64 ( const char *s, int32_t len,
uint64_t startHash ) {
static inline uint64_t hash64 ( const char *s, int32_t len,
uint64_t startHash = 0 ) {
uint64_t h = startHash;
int32_t i = 0;
while ( i < len ) {
@ -75,7 +63,7 @@ inline uint64_t hash64 ( const char *s, int32_t len,
return h;
}
inline uint64_t hash64_cont ( const char *s, int32_t len,
static inline uint64_t hash64_cont ( const char *s, int32_t len,
uint64_t startHash ,
int32_t *conti ) {
uint64_t h = startHash;
@ -88,14 +76,14 @@ inline uint64_t hash64_cont ( const char *s, int32_t len,
return h;
}
inline uint32_t hash32Fast ( uint32_t h1 , uint32_t h2 ) {
static inline uint32_t hash32Fast ( uint32_t h1 , uint32_t h2 ) {
return (h2 << 1) ^ h1;
}
// . combine 2 hashes into 1
// . TODO: ensure this is a good way
// . used for combining words' hashes into phrases (also fields,collections)..
inline uint64_t hash64 (uint64_t h1,uint64_t h2){
static inline uint64_t hash64 (uint64_t h1,uint64_t h2){
// treat the 16 bytes as a string now instead of multiplying them
uint64_t h = 0;
@ -121,8 +109,8 @@ inline uint64_t hash64 (uint64_t h1,uint64_t h2){
}
inline uint64_t hash64Lower_a ( const char *s, int32_t len,
uint64_t startHash ) {
static inline uint64_t hash64Lower_a ( const char *s, int32_t len,
uint64_t startHash = 0) {
uint64_t h = startHash;
int32_t i = 0;
while ( i < len ) {
@ -134,7 +122,7 @@ inline uint64_t hash64Lower_a ( const char *s, int32_t len,
}
// utf8
inline uint64_t hash64Lower_utf8 ( const char *p, int32_t len, uint64_t startHash ) {
static inline uint64_t hash64Lower_utf8 ( const char *p, int32_t len, uint64_t startHash = 0) {
uint64_t h = startHash;
uint8_t i = 0;
const char *pend = p + len;
@ -192,7 +180,7 @@ inline uint64_t hash64Lower_utf8 ( const char *p, int32_t len, uint64_t startHas
return h;
}
inline uint64_t hash64Lower_utf8_nospaces ( const char *p, int32_t len ) {
static inline uint64_t hash64Lower_utf8_nospaces ( const char *p, int32_t len ) {
uint64_t h = 0LL;
uint8_t i = 0;
const char *pend = p + len;
@ -243,7 +231,7 @@ inline uint64_t hash64Lower_utf8_nospaces ( const char *p, int32_t len ) {
}
inline uint64_t hash64Lower_utf8_cont ( const char *p,
static inline uint64_t hash64Lower_utf8_cont ( const char *p,
int32_t len,
uint64_t startHash ,
int32_t *conti ) {
@ -304,7 +292,7 @@ inline uint64_t hash64Lower_utf8_cont ( const char *p,
return h;
}
inline uint32_t hash32_cont ( const char *p, int32_t plen,
static inline uint32_t hash32_cont ( const char *p, int32_t plen,
uint32_t startHash , int32_t *conti ) {
uint32_t h = startHash;
uint8_t i = *conti;
@ -321,7 +309,7 @@ inline uint32_t hash32_cont ( const char *p, int32_t plen,
// utf8
// exactly like above but p is NULL terminated for sure
inline uint64_t hash64Lower_utf8 ( const char *p ) {
static inline uint64_t hash64Lower_utf8 ( const char *p ) {
uint64_t h = 0;
uint8_t i = 0;
UChar32 x;
@ -369,7 +357,7 @@ inline uint64_t hash64Lower_utf8 ( const char *p ) {
}
inline uint64_t hash64Upper_a ( const char *s , int32_t len ,
static inline uint64_t hash64Upper_a ( const char *s , int32_t len ,
uint64_t startHash ) {
uint64_t h = startHash;
int32_t i = 0;
@ -382,7 +370,7 @@ inline uint64_t hash64Upper_a ( const char *s , int32_t len ,
}
inline uint32_t hashLong ( uint32_t x ) {
static inline uint32_t hashLong ( uint32_t x ) {
uint32_t h = 0;
unsigned char *p = (unsigned char *)&x;
h ^= (uint32_t) g_hashtab [0][p[0]];