From 95f7e8b79c68edbcc99309fbf406d6d9daf8e063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Skytte=20J=C3=B8rgensen?= <isj-github@privacore.com> Date: Thu, 26 Jul 2018 17:01:42 +0200 Subject: [PATCH] Moved 'gbmemcpy' macro to separate file --- Dns.cpp | 1 + HashTableX.cpp | 1 + Hostdb.cpp | 1 + HttpMime.cpp | 1 + HttpRequest.cpp | 1 + HttpServer.cpp | 1 + Images.cpp | 1 + Msg0.cpp | 1 + Msg25.cpp | 1 + Parms.cpp | 1 + RdbBuckets.cpp | 1 + RdbCache.cpp | 1 + RdbList.cpp | 1 + SafeBuf.cpp | 1 + SiteGetter.cpp | 1 + Synonyms.cpp | 1 + Tagdb.cpp | 1 + UdpSlot.cpp | 1 + Url.cpp | 1 + Wiktionary.cpp | 1 + Xml.cpp | 1 + XmlDoc.cpp | 1 + XmlDoc_Indexing.cpp | 1 + fctypes.cpp | 1 + gb-include.h | 3 --- gbmemcpy.h | 7 +++++++ 26 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 gbmemcpy.h diff --git a/Dns.cpp b/Dns.cpp index 38324be3..6eee7b8b 100644 --- a/Dns.cpp +++ b/Dns.cpp @@ -7,6 +7,7 @@ #include "Dns_internals.h" #include "ip.h" #include "Mem.h" +#include "gbmemcpy.h" #include <fcntl.h> diff --git a/HashTableX.cpp b/HashTableX.cpp index 8c9eb077..f16dc2c5 100644 --- a/HashTableX.cpp +++ b/HashTableX.cpp @@ -8,6 +8,7 @@ #include "Conf.h" #include "Sanity.h" #include <fcntl.h> +#include "gbmemcpy.h" HashTableX::HashTableX () { diff --git a/Hostdb.cpp b/Hostdb.cpp index fbb6d839..67b1b8cc 100644 --- a/Hostdb.cpp +++ b/Hostdb.cpp @@ -22,6 +22,7 @@ #include <sys/types.h> #include <ifaddrs.h> #include <sys/types.h> +#include "gbmemcpy.h" // a global class extern'd in .h file Hostdb g_hostdb; diff --git a/HttpMime.cpp b/HttpMime.cpp index 364ea030..b0fc3412 100644 --- a/HttpMime.cpp +++ b/HttpMime.cpp @@ -5,6 +5,7 @@ #include "HashTableX.h" #include "Process.h" #include "Conf.h" +#include "gbmemcpy.h" #ifdef _VALGRIND_ #include <valgrind/memcheck.h> diff --git a/HttpRequest.cpp b/HttpRequest.cpp index 083b947b..d5d1dce6 100644 --- a/HttpRequest.cpp +++ b/HttpRequest.cpp @@ -12,6 +12,7 @@ #include "CountryLanguage.h" #include <stdlib.h> #include <float.h> +#include "gbmemcpy.h" HttpRequest::HttpRequest () { diff --git a/HttpServer.cpp b/HttpServer.cpp index 5c028df3..a2b188c4 100644 --- a/HttpServer.cpp +++ b/HttpServer.cpp @@ -26,6 +26,7 @@ #include "GbUtil.h" #include "Mem.h" #include "ContentTypeBlockList.h" +#include "gbmemcpy.h" #include <fcntl.h> diff --git a/Images.cpp b/Images.cpp index f72d3004..aa0120d1 100644 --- a/Images.cpp +++ b/Images.cpp @@ -15,6 +15,7 @@ #include <pthread.h> #include <fcntl.h> #include <arpa/inet.h> +#include "gbmemcpy.h" // TODO: image is bad if repeated on same page, check for that diff --git a/Msg0.cpp b/Msg0.cpp index 5c2b4aa3..42c4c093 100644 --- a/Msg0.cpp +++ b/Msg0.cpp @@ -19,6 +19,7 @@ #include "Mem.h" #include "JobScheduler.h" #include "SpiderdbRdbSqliteBridge.h" +#include "gbmemcpy.h" class State00; diff --git a/Msg25.cpp b/Msg25.cpp index 990b9923..c8ca0b15 100644 --- a/Msg25.cpp +++ b/Msg25.cpp @@ -17,6 +17,7 @@ #include "Mem.h" #include "SiteGetter.h" #include "ip.h" +#include "gbmemcpy.h" #ifdef _VALGRIND_ #include <valgrind/memcheck.h> diff --git a/Parms.cpp b/Parms.cpp index 8735d03f..0912f598 100644 --- a/Parms.cpp +++ b/Parms.cpp @@ -42,6 +42,7 @@ #include "SiteMedianPageTemperature.h" #include <set> #include <fstream> +#include "gbmemcpy.h" class WaitEntry { diff --git a/RdbBuckets.cpp b/RdbBuckets.cpp index ed6f916d..6ba8b2b4 100644 --- a/RdbBuckets.cpp +++ b/RdbBuckets.cpp @@ -11,6 +11,7 @@ #include "ScopedLock.h" #include <fcntl.h> #include "Posdb.h" +#include "gbmemcpy.h" #define BUCKET_SIZE 8192 #define INIT_SIZE 4096 diff --git a/RdbCache.cpp b/RdbCache.cpp index 5e8dc9e2..40df7abf 100644 --- a/RdbCache.cpp +++ b/RdbCache.cpp @@ -15,6 +15,7 @@ #include "Conf.h" #include "Mem.h" #include <fcntl.h> +#include "gbmemcpy.h" static const int64_t m_maxColls = (1LL << (sizeof(collnum_t)*8)); // 65536 diff --git a/RdbList.cpp b/RdbList.cpp index 601f30b9..81cacdc7 100644 --- a/RdbList.cpp +++ b/RdbList.cpp @@ -10,6 +10,7 @@ #include "Mem.h" #include <set> #include <assert.h> +#include "gbmemcpy.h" static const int signature_init = 0x07b39a1b; diff --git a/SafeBuf.cpp b/SafeBuf.cpp index 8149d277..0b7a0928 100644 --- a/SafeBuf.cpp +++ b/SafeBuf.cpp @@ -5,6 +5,7 @@ #include "Sanity.h" #include <sys/stat.h> //O_CREAT etc. #include <fcntl.h> //open() +#include "gbmemcpy.h" SafeBuf::SafeBuf(int32_t initSize, const char *label ) { diff --git a/SiteGetter.cpp b/SiteGetter.cpp index 15c7da50..561a80a3 100644 --- a/SiteGetter.cpp +++ b/SiteGetter.cpp @@ -5,6 +5,7 @@ #include "Conf.h" #include "Collectiondb.h" #include "Process.h" +#include "gbmemcpy.h" // // BASIC IDEA diff --git a/Synonyms.cpp b/Synonyms.cpp index 4e6f199b..b77dab19 100644 --- a/Synonyms.cpp +++ b/Synonyms.cpp @@ -6,6 +6,7 @@ #include "Lang.h" #include "GbUtil.h" #include "Sanity.h" +#include "gbmemcpy.h" #ifdef _VALGRIND_ #include <valgrind/memcheck.h> diff --git a/Tagdb.cpp b/Tagdb.cpp index 9206b5b7..8c77c5ce 100644 --- a/Tagdb.cpp +++ b/Tagdb.cpp @@ -19,6 +19,7 @@ #include "GbUtil.h" #include "ScopedLock.h" #include "Mem.h" +#include "gbmemcpy.h" static HashTableX s_ht; diff --git a/UdpSlot.cpp b/UdpSlot.cpp index 1659f0ed..909648f9 100644 --- a/UdpSlot.cpp +++ b/UdpSlot.cpp @@ -14,6 +14,7 @@ #ifdef _VALGRIND_ #include <valgrind/memcheck.h> #endif +#include "gbmemcpy.h" int32_t g_cancelAcksSent = 0; int32_t g_cancelAcksRead = 0; diff --git a/Url.cpp b/Url.cpp index 3a1f245f..65422b49 100644 --- a/Url.cpp +++ b/Url.cpp @@ -10,6 +10,7 @@ #include "GbMutex.h" #include "ScopedLock.h" #include "GbUtil.h" +#include "gbmemcpy.h" #include <vector> #include <algorithm> diff --git a/Wiktionary.cpp b/Wiktionary.cpp index 831cb83c..882df75c 100644 --- a/Wiktionary.cpp +++ b/Wiktionary.cpp @@ -11,6 +11,7 @@ #include "Mem.h" #include <sys/stat.h> //stat() #include <fcntl.h> +#include "gbmemcpy.h" // the global instance Wiktionary g_wiktionary; diff --git a/Xml.cpp b/Xml.cpp index 869890ea..4a16fcb2 100644 --- a/Xml.cpp +++ b/Xml.cpp @@ -8,6 +8,7 @@ #include "Pos.h" #include "Sanity.h" #include "Conf.h" +#include "gbmemcpy.h" Xml::Xml () { diff --git a/XmlDoc.cpp b/XmlDoc.cpp index 65da9627..c1d0d7e5 100644 --- a/XmlDoc.cpp +++ b/XmlDoc.cpp @@ -60,6 +60,7 @@ #include <iostream> #include <fstream> #include <sysexits.h> +#include "gbmemcpy.h" #ifdef _VALGRIND_ #include <valgrind/memcheck.h> diff --git a/XmlDoc_Indexing.cpp b/XmlDoc_Indexing.cpp index ed5044ab..69fb7e85 100644 --- a/XmlDoc_Indexing.cpp +++ b/XmlDoc_Indexing.cpp @@ -18,6 +18,7 @@ #include "Lemma.h" #include <unordered_set> #include <string> +#include "gbmemcpy.h" #ifdef _VALGRIND_ diff --git a/fctypes.cpp b/fctypes.cpp index a55eabab..54a1f98b 100644 --- a/fctypes.cpp +++ b/fctypes.cpp @@ -10,6 +10,7 @@ #include "Hostdb.h" #include "Mem.h" #include <fcntl.h> +#include "gbmemcpy.h" char *strncasestr( char *haystack, int32_t haylen, const char *needle){ diff --git a/gb-include.h b/gb-include.h index 89d5fb96..fa749aa5 100644 --- a/gb-include.h +++ b/gb-include.h @@ -1,9 +1,6 @@ #ifndef GB_INCLUDE_H #define GB_INCLUDE_H -//The function below are legacy. Don't use them in new code -#define gbmemcpy(xx,yy,zz) memmove(xx,yy,zz) - #include <inttypes.h> #include <bits/wordsize.h> diff --git a/gbmemcpy.h b/gbmemcpy.h new file mode 100644 index 00000000..6339ccbb --- /dev/null +++ b/gbmemcpy.h @@ -0,0 +1,7 @@ +#ifndef GBMEMCPY_H_ +#define GBMEMCPY_H_ + +//The function below is legacy. Don't use it in new code +#define gbmemcpy(xx,yy,zz) memmove(xx,yy,zz) + +#endif