Cleanup in Mem.h

Removed unnecessary #includes. Turned out that includign Mem.h was mostly
equivalent to #include *.* because Mem.h would pull in Xml.h, File.h Hostdb.h
etc. A small step toward making header files and modules self-contained.
This commit is contained in:
Ivan Skytte Jørgensen
2016-03-14 00:37:18 +01:00
parent 636021bb55
commit 642552d040
14 changed files with 21 additions and 39 deletions

@ -2,6 +2,8 @@
#include "HashTable.h"
#include "LanguageIdentifier.h"
#include "Threads.h"
#include "HashTableX.h"
#include "Lang.h"
#include <sys/types.h>

@ -2,6 +2,7 @@
#include "HashTable.h"
#include "BitOperations.h"
#include "File.h"
HashTable::HashTable () {
m_keys = NULL;

@ -8,6 +8,9 @@
#include "Threads.h"
#include "Mem.h" // for mcalloc and mmalloc
#include "BitOperations.h"
#include "Loop.h"
#include "File.h"
#include "Conf.h"
void HashTableX::constructor() {

@ -5,6 +5,8 @@
#include "HttpMime.h"
#include "HashTable.h"
#include "Timezone.h"
#include "HashTableX.h"
#ifdef _VALGRIND_
#include <valgrind/memcheck.h>
#endif

@ -2,6 +2,7 @@
#include "HttpRequest.h"
#include "ip.h"
#include "Conf.h"
HttpRequest::HttpRequest () { m_cgiBuf = NULL; m_cgiBuf2 = NULL; reset(); }
HttpRequest::~HttpRequest() { reset(); }

1
Loop.h

@ -15,6 +15,7 @@
#define F_SETSIG 10 // F_SETSIG
#endif
#include "Mem.h" // mmalloc, mfree
#include <stdio.h>
#define QUERYPRIORITYWEIGHT 16
#define QUICKPOLL_INTERVAL 10

30
Mem.cpp

@ -1589,36 +1589,6 @@ uint64_t getHighestLitBitValueLL ( uint64_t bits ) {
return highest;
}
// TODO: speed up
int64_t htonll ( uint64_t a ) {
int64_t b;
unsigned int int0 = htonl ( ((uint32_t *)&a)[0] );
unsigned int int1 = htonl ( ((uint32_t *)&a)[1] );
((unsigned int *)&b)[0] = int1;
((unsigned int *)&b)[1] = int0;
return b;
}
// just swap 'em back
int64_t ntohll ( uint64_t a ) {
return htonll ( a );
}
key_t htonkey ( key_t key ) {
key_t newKey;
newKey.n0 = htonll ( key.n0 );
newKey.n1 = htonl ( key.n1 );
return newKey;
}
key_t ntohkey ( key_t key ) {
key_t newKey;
newKey.n0 = ntohll ( key.n0 );
newKey.n1 = ntohl ( key.n1 );
return newKey;
}
// . TODO: avoid byteCopy by copying remnant bytes
// . ass = async signal safe, dumb ass

11
Mem.h

@ -9,19 +9,14 @@
#ifndef GB_MEM_H
#define GB_MEM_H
#include <sys/mman.h> // mlockall
#include <netinet/in.h> // for htonll
#include "Conf.h"
#include <new>
#include <stddef.h> //for NULL
#include <string.h> //for strlen()
#include <inttypes.h>
extern bool g_inMemFunction;
class SafeBuf;
// some memory manipulation functions inlined below
int64_t htonll ( uint64_t a );
int64_t ntohll ( uint64_t a );
key_t ntohkey ( key_t key ) ;
key_t htonkey ( key_t key ) ;
inline int gbstrlen ( const char *s ) {

@ -1,6 +1,7 @@
#include "gb-include.h"
#include "Msg1f.h"
#include "Conf.h"
static void handleRequest ( UdpSlot *slot , int32_t netnice );
#define LOG_WINDOW 2048

@ -43,6 +43,7 @@
#include "RdbList.h"
#include "BigFile.h"
#include "RdbMem.h"
#include <sys/mman.h> //PROT_READ etc.
class RdbTree {

@ -15,6 +15,8 @@
#define GB_SEARCHINPUT_H
#include "Query.h" // MAX_QUERY_LEN
#include "HttpRequest.h"
#include "Collectiondb.h"
class SearchInput {
public:

@ -17,6 +17,7 @@
#include "StopWords.h"
#include "Query.h"
#include "Multicast.h"
#include "HashTableX.h"
class Speller {

@ -2,6 +2,7 @@
// automated versioning for gigablast
#include <stdio.h>
#include "Mem.h"
#include "Log.h"
static char s_vbuf[32];
@ -18,7 +19,7 @@ char *getVersion ( ) {
sprintf(s_vbuf,"%s %s", __DATE__, __TIME__ );
// PingServer.cpp needs this exactly to be 24
if ( gbstrlen(s_vbuf) != getVersionSize() - 1 ) {
log("getVersion: %s %"INT32" != %"INT32"",
log("getVersion: %s %"PRId32" != %"PRId32"",
s_vbuf,
(int32_t)gbstrlen(s_vbuf),
getVersionSize() - 1);

@ -5,6 +5,7 @@
#include "SafeBuf.h"
#include "Xml.h"
#include "XmlNode.h"
#include "Conf.h"
static bool g_clockInSync = false;