Remove more unused variables/functions

This commit is contained in:
Ai Lin Chia
2016-03-02 13:50:11 +01:00
parent 1e444b9b1c
commit 9a95d5c180
5 changed files with 7 additions and 207 deletions

@ -324,8 +324,6 @@ void Msg20::gotReply ( UdpSlot *slot ) {
// cast it
m_r = (Msg20Reply *)rp;
m_r->m_parentOwner = (void *)this;
// we own it now
m_ownReply = true;
@ -474,11 +472,6 @@ bool gotReplyWrapperxd ( void *state ) {
}
Msg20Reply::Msg20Reply ( ) {
// this is free in destructor, so clear it here
//ptr_eventSummaryLines = NULL;
m_parentOwner = NULL;
// seems to be an issue... caused a core with bogus size_dbuf
int32_t *sizePtr = &size_tbuf;
int32_t *sizeEnd = &size_note;
@ -577,7 +570,6 @@ int32_t Msg20::deserialize ( char *buf , int32_t bufSize ) {
if ( bufSize < (int32_t)sizeof(Msg20Reply) ) {
g_errno = ECORRUPTDATA; return -1; }
m_r = (Msg20Reply *)buf;
m_r->m_parentOwner = (void *)this;
// do not free "buf"/"m_r"
m_ownReply = false;
return m_r->deserialize ( );

@ -92,7 +92,7 @@ class Msg20Request {
char *ptr_linkee ; // used by Msg25 for getting link text
char *ptr_displayMetas ;
// . from here down: automatically set in Msg20Request::serialize()
// . from here down: automatically set in Msg20Request::serialize()
// from the above parms
// . add new size_* parms after size_qbuf and before size_displayMetas
// so that serialize()/deserialize() still work
@ -157,7 +157,6 @@ public:
char m_hopcount ;
char m_recycled ;
uint8_t m_language ;
uint8_t m_summaryLanguage ;
uint16_t m_country ;
uint16_t m_computedCountry ;
int16_t m_charset ;
@ -178,7 +177,6 @@ public:
int32_t m_linkTextNumWords ;
int32_t m_midDomHash ; // set for m_getLinkText
void *m_parentOwner;
char m_isLinkSpam ; // set for m_getLinkText
char m_outlinkInContent ; // set for m_getLinkText

86
Parms.h

@ -4,36 +4,14 @@
// from Parms.cpp. But Parms need to be marked if they contribute to
// SearchInput::makeKey() for caching the SERPS.
#ifndef _PARMS_H_
#define _PARMS_H_
#ifndef PARMS_H
#define PARMS_H
#include "Rdb.h"
//#include "CollectionRec.h"
void handleRequest3e ( UdpSlot *slot , int32_t niceness ) ;
void handleRequest3f ( UdpSlot *slot , int32_t niceness ) ;
// "url filters profile" values. used to set default crawl rules
// in Collectiondb.cpp's CollectionRec::setUrlFiltersToDefaults().
// for instance, UFP_NEWS spiders sites more frequently but less deep in
// order to get "news" pages and articles
//enum {
// UFP_CUSTOM = 0 ,
// UFP_NONE = 0 ,
// UFP_WEB = 1 ,
// UFP_NEWS = 2 ,
// UFP_LANG = 3,
// UFP_SHALLOW = 4
//};
// special priorities for the priority drop down
// in the url filters table
//enum {
// SPIDER_PRIORITY_FILTERED = -3 ,
// SPIDER_PRIORITY_BANNED = -2 ,
// SPIDER_PRIORITY_UNDEFINED = -1 };
enum {
OBJ_CONF = 1 ,
OBJ_COLL ,
@ -129,7 +107,6 @@ class GigablastRequest {
int64_t m_docId;
int32_t m_strip;
char m_includeHeader;
char m_highlightQuery;
///////////
//
@ -153,27 +130,8 @@ class GigablastRequest {
char *m_qlang;
bool m_forceDel;
char m_recycleContent;
// useful bufs to copy data over
SafeBuf m_tmpBuf1;
SafeBuf m_tmpBuf2;
SafeBuf m_tmpBuf3;
};
// values for Parm::m_subMenu
#define SUBMENU_DISPLAY 1
#define SUBMENU_MAP 2
#define SUBMENU_CALENDAR 3
#define SUBMENU_LOCATION 4
#define SUBMENU_SOCIAL 5
#define SUBMENU_TIME 6
#define SUBMENU_CATEGORIES 7
#define SUBMENU_LINKS 8
#define SUBMENU_WIDGET 9
#define SUBMENU_SUGGESTIONS 10
#define SUBMENU_SEARCH 11
#define SUBMENU_CHECKBOX 0x80 // flag
// values for Parm::m_flags
#define PF_COOKIE 0x01 // store in cookie?
#define PF_REDBOX 0x02 // redbox constraint on search results
@ -205,9 +163,7 @@ class Parm {
const char *m_title; // displayed above m_desc on admin gui page
const char *m_desc; // description of variable displayed on admin gui page
const char *m_cgi; // cgi name, contains %i if an array
const char *m_cgi2; // alias
const char *m_cgi3; // alias
const char *m_cgi4; // alias
char *m_xml; // default to rendition of m_title if NULL
int32_t m_off; // this variable's offset into the CollectionRec class
char m_colspan;
@ -220,8 +176,6 @@ class Parm {
// CollectionRec.h or Conf.h.
bool isArray() { return (m_max>1); };
int32_t getNumInArray() ;
int32_t m_max; // max elements in the array
// if array is fixed size, how many elements in it?
// this is 0 if not a FIXED size array.
@ -243,8 +197,6 @@ class Parm {
char *m_qterm;
char *m_pstr; // for sorting by in sendPageAPI()
int32_t m_parmNum; // slot # in the m_parms[] array that we are
//bool (*m_func)(TcpSocket *s , HttpRequest *r,
// bool (*cb)(TcpSocket *s , HttpRequest *r));
bool (*m_func)(char *parmRec);
// some functions can block, like when deleting a coll because
// the tree might be saving, so they take a "we" ptr
@ -254,16 +206,11 @@ class Parm {
char m_save; // save to xml file? almost always true
int32_t m_min;
// these are used for search parms in PageResults.cpp
//char m_sparm;// is this a search parm? for passing to PageResults.cpp
//char *m_scgi; // parm in the search url
char m_spriv; // is it private? only admins can see/use private parms
//char *m_scmd; // the url path for this m_scgi variable
//int32_t m_sdefo; // offset of default into CollectionRec (use m_off)
int32_t m_sminc ;// offset of min in CollectionRec (-1 for none)
int32_t m_smaxc ;// offset of max in CollectionRec (-1 for none)
int32_t m_smin; // absolute min
int32_t m_smax; // absolute max
//int32_t m_soff; // offset into SearchInput to store value in
char m_sprpg; // propagate the cgi variable to other pages via GET?
char m_sprpp; // propagate the cgi variable to other pages via POST?
bool m_sync; // this parm should be synced
@ -298,7 +245,6 @@ class Parms {
bool printParmTable ( SafeBuf *sb , TcpSocket *s , HttpRequest *r );
//char *printParms (char *p, char *pend, TcpSocket *s, HttpRequest *r);
bool printParms (SafeBuf* sb, TcpSocket *s , HttpRequest *r );
bool printParms2 (SafeBuf* sb,
@ -314,7 +260,6 @@ class Parms {
);
bool printParm ( SafeBuf* sb,
//int32_t user ,
char *username,
Parm *m ,
int32_t mm , // m = &m_parms[mm]
@ -357,14 +302,10 @@ class Parms {
char *filenameDef ,
char objType ) ;
bool setParmsFromXml ( Xml &xml , void *THIS, char objType ) ;
bool setXmlFromFile(Xml *xml, char *filename, class SafeBuf *sb );
bool saveToXml ( char *THIS , char *f , char objType ) ;
bool convertToXml ( char *buf , char *THIS , char objType ) ;
bool getParmHtmlEncoded ( SafeBuf *sb , Parm *m , char *s );
bool setGigablastRequest ( class TcpSocket *s ,
@ -376,28 +317,8 @@ class Parms {
// freeing the safebufs now used by the new one.
void detachSafeBufs ( class CollectionRec *cr ) ;
// calc checksum of parms
uint32_t calcChecksum();
// get size of serialized parms
//int32_t getStoredSize();
// . serialized to buf
// . if buf is NULL, just calcs size
//bool serialize( char *buf, int32_t *bufSize );
//void deserialize( char *buf );
void overlapTest ( char step ) ;
/////
//
// parms now in parmdb
//
/////
// all parm recs need to be in the tree
//Rdb m_rdb;
//
// new functions
//
@ -432,7 +353,6 @@ class Parms {
bool doParmSendingLoop ( ) ;
bool syncParmsWithHost0 ( ) ;
bool makeSyncHashList ( SafeBuf *hashList ) ;
int32_t getNumInArray ( collnum_t collnum ) ;
bool addAllParmsToList ( SafeBuf *parmList, collnum_t collnum ) ;
bool updateParm ( char *rec , class WaitEntry *we ) ;

@ -5175,44 +5175,6 @@ bool XmlDoc::hashString_ct ( HashTableX *ct , char *s , int32_t slen ) {
return true;
}
uint8_t *XmlDoc::getSummaryLangId ( ) {
// return if we got it already
if ( m_summaryLangIdValid ) {
return &m_summaryLangId;
}
Summary *s = getSummary();
if ( !s || s == (void *)-1 ) {
return (uint8_t *)s;
}
int64_t start = logQueryTimingStart();
// now set the words class
Words ww;
if ( ! ww.set ( s->getSummary(), s->getSummaryLen(), true, m_niceness ) ) {
return NULL;
}
// check it out. 0 means langUnknown. -1 means error.
int32_t ret = ww.getLanguage ( NULL , 100 , m_niceness , NULL );
logQueryTimingEnd(__func__, start);
// -1 means error! g_errno should be set
if ( ret < 0 ) {
return NULL;
}
// set it
m_summaryLangId = (uint8_t)ret;
// assume valid
m_summaryLangIdValid = true;
// return it
return &m_summaryLangId;
}
int cmp ( const void *h1 , const void *h2 ) ;
// vector components are 32-bit hashes
@ -19478,16 +19440,6 @@ Msg20Reply *XmlDoc::getMsg20Reply ( ) {
// breathe
QUICKPOLL ( m_niceness );
if ( m_req->m_numSummaryLines > 0 ) {
// turn off for now since we added this to posdb
uint8_t *sl = getSummaryLangId();
if ( ! sl || sl == (void *)-1 ) return (Msg20Reply *)sl;
reply->m_summaryLanguage = *sl;
}
// breathe
QUICKPOLL ( m_niceness );
// returns values of specified meta tags
if ( ! reply->ptr_dbuf && m_req->size_displayMetas > 1 ) {
int32_t dsize; char *d;

@ -15,8 +15,8 @@
// Msg4::addMetaList(), which is only called by Msg14 or Repair.cpp for now
#ifndef _XMLDOC_H_
#define _XMLDOC_H_
#ifndef XMLDOC_H
#define XMLDOC_H
#include "Lang.h"
#include "Words.h"
@ -190,15 +190,9 @@ public:
int32_t m_reserved1;
int32_t m_reserved2;
uint32_t m_spideredTime; // time_t
// just don't throw away any relevant SpiderRequests and we have
// the data that m_minPubDate and m_maxPubDate provided
//time_t m_minPubDate;
//time_t m_maxPubDate;
uint32_t m_indexedTime; // slightly > m_spideredTime (time_t)
uint32_t m_reserved32;
uint32_t reserved3; //was: m_pubDate; // aka m_datedbDate // time_t
//time_t m_nextSpiderTime;
uint32_t m_firstIndexedDate; // time_t
uint32_t m_outlinksAddedDate; // time_t
@ -317,10 +311,6 @@ public:
public:
void print ( );
bool set2 ( char *titleRec,
int32_t maxSize,
char *coll,
@ -362,7 +352,6 @@ public:
void nukeDoc ( class XmlDoc *);
void reset ( ) ;
bool setFirstUrl ( char *u , bool addWWW , Url *base = NULL ) ;
bool setRedirUrl ( char *u , bool addWWW ) ;
void setStatus ( char *s ) ;
void setCallback ( void *state, void (*callback) (void *state) ) ;
void setCallback ( void *state, bool (*callback) (void *state) ) ;
@ -372,7 +361,6 @@ public:
bool indexDoc2 ( );
key_t *getTitleRecKey() ;
//char *getSkipIndexing ( );
char *prepareToMakeTitleRec ( ) ;
// store TitleRec into "buf" so it can be added to metalist
bool setTitleRecBuf ( SafeBuf *buf , int64_t docId, int64_t uh48 );
@ -385,7 +373,6 @@ public:
SafeBuf m_spiderStatusDocMetaList;
char *getIsAdult ( ) ;
int32_t getOutlinkAge ( int32_t outlinkNum ) ;
char *getIsPermalink ( ) ;
char *getIsUrlPermalinkFormat ( ) ;
char *getIsRSS ( ) ;
@ -404,7 +391,6 @@ public:
class Links *getLinks ( bool doQuickSet = false ) ;
class HashTableX *getCountTable ( ) ;
bool hashString_ct ( class HashTableX *ht, char *s , int32_t slen ) ;
uint8_t *getSummaryLangId ( ) ;
int32_t *getSummaryVector ( ) ;
int32_t *getPageSampleVector ( ) ;
int32_t *getPostLinkTextVector ( int32_t linkNode ) ;
@ -415,15 +401,12 @@ public:
uint64_t *getFuzzyDupHash ( );
int64_t *getExactContentHash64();
class RdbList *getDupList ( ) ;
class RdbList *getLikedbListForReq ( );
class RdbList *getLikedbListForIndexing ( );
char *getIsDup ( ) ;
char *getMetaDescription( int32_t *mdlen ) ;
char *getMetaSummary ( int32_t *mslen ) ;
char *getMetaKeywords( int32_t *mklen ) ;
char *getMetaGeoPlacename( int32_t *mgplen );
int32_t *getSiteSpiderQuota ( ) ;
class Url *getCurrentUrl ( ) ;
class Url *getFirstUrl() ;
int64_t getFirstUrlHash48();
@ -434,21 +417,13 @@ public:
class Url **getCanonicalRedirUrl ( ) ;
int32_t *getFirstIndexedDate ( ) ;
int32_t *getOutlinksAddedDate ( ) ;
//int32_t *getNumBannedOutlinks ( ) ;
uint16_t *getCountryId ( ) ;
class XmlDoc **getOldXmlDoc ( ) ;
//bool isRobotsTxtFile ( char *url , int32_t urlLen ) ;
class XmlDoc **getExtraDoc ( char *url , int32_t maxCacheAge = 0 ) ;
bool getIsPageParser ( ) ;
class XmlDoc **getRootXmlDoc ( int32_t maxCacheAge = 0 ) ;
//class XmlDoc **getGatewayXmlDoc ( ) ;
// . returns false if blocked, true otherwise.
// . returns true and sets g_errno on error
//bool setFromOldTitleRec ( ) ;
//RdbList *getOldMetaList ( ) ;
char **getOldTitleRec ( );
uint8_t *getRootLangId ();
//bool *updateRootLangId ( );
char **getRootTitleRec ( ) ;
int64_t *getAvailDocIdOnly ( int64_t preferredDocId ) ;
int64_t *getDocId ( ) ;
@ -456,12 +431,6 @@ public:
class TagRec *getTagRec ( ) ;
// non-dup/nondup addresses only
int32_t *getFirstIp ( ) ;
bool *updateFirstIp ( ) ;
//int32_t *getSiteNumInlinksUniqueIp ( ) ;
//int32_t *getSiteNumInlinksUniqueCBlock ( ) ;
//int32_t *getSiteNumInlinksTotal ( );
//int32_t *getSiteNumInlinksFresh ( ) ;
//int32_t *getSitePop ( ) ;
uint8_t *getSiteNumInlinks8 () ;
int32_t *getSiteNumInlinks ( ) ;
class LinkInfo *getSiteLinkInfo() ;
@ -470,10 +439,6 @@ public:
bool *getIsAllowed ( ) ;
int32_t *getFinalCrawlDelay();
int32_t m_finalCrawlDelay;
//int32_t getTryAgainTimeDelta() {
// if ( ! m_tryAgainTimeDeltaValid ) { char *xx=NULL;*xx=0;}
// return m_tryAgainTimeDelta;
//};
char *getIsWWWDup ( ) ;
class LinkInfo *getLinkInfo1 ( ) ;
char *getSite ( ) ;
@ -503,7 +468,6 @@ public:
// we download large files to a file on disk, like warcs and arcs
int32_t *getContentHash32 ( ) ;
int32_t *getContentHashJson32 ( ) ;
//int32_t *getTagHash32 ( ) ;
int32_t *getTagPairHashVector ( ) ;
uint32_t *getTagPairHash32 ( ) ;
int32_t getHostHash32a ( ) ;
@ -511,22 +475,13 @@ public:
int32_t getDomHash32 ( );
char **getThumbnailData();
class Images *getImages ( ) ;
int8_t *getNextSpiderPriority ( ) ;
int32_t *getPriorityQueueNum ( ) ;
class TagRec ***getOutlinkTagRecVector () ;
char *hasNoIndexMetaTag();
char *hasFakeIpsMetaTag ( );
int32_t **getOutlinkFirstIpVector () ;
//char **getOutlinkIsIndexedVector () ;
int32_t *getRegExpNum ( int32_t outlinkNum ) ;
int32_t *getRegExpNum2 ( int32_t outlinkNum ) ;
char *getIsSiteRoot ( ) ;
bool getIsOutlinkSiteRoot ( char *u , class TagRec *gr ) ;
int8_t *getHopCount ( ) ;
//int8_t *getOutlinkHopCountVector ( ) ;
char *getSpiderLinks ( ) ;
int32_t *getNextSpiderTime ( ) ;
//char *getIsSpam() ;
char *getIsFiltered ();
bool getIsInjecting();
int32_t *getSpiderPriority ( ) ;
@ -534,7 +489,6 @@ public:
int32_t *getIndexCode2 ( ) ;
SafeBuf *getNewTagBuf ( ) ;
char *updateTagdb ( ) ;
bool logIt ( class SafeBuf *bb = NULL ) ;
bool m_doConsistencyTesting;
bool doConsistencyTest ( bool forceTest ) ;
@ -550,7 +504,6 @@ public:
char *getMetaList ( bool forDelete = false );
uint64_t m_downloadStartTime;
//uint64_t m_downloadEndTime;
uint64_t m_ipStartTime;
uint64_t m_ipEndTime;
@ -565,8 +518,6 @@ public:
// m_indexCode or g_errno was set!
class SpiderReply *getNewSpiderReply ( );
SpiderRequest **getRedirSpiderRequest ( );
SpiderRequest m_redirSpiderRequest;
SpiderRequest *m_redirSpiderRequestPtr;
@ -590,10 +541,7 @@ public:
bool hashNoSplit ( class HashTableX *tt ) ;
char *hashAll ( class HashTableX *table ) ;
int32_t getBoostFromSiteNumInlinks ( int32_t inlinks ) ;
bool hashSpiderReply (class SpiderReply *reply ,class HashTableX *tt) ;
bool hashMetaTags ( class HashTableX *table ) ;
bool hashIsClean ( class HashTableX *table ) ;
bool hashMetaZip ( class HashTableX *table ) ;
bool hashContentType ( class HashTableX *table ) ;
@ -642,9 +590,7 @@ public:
char* matchErrorMsg(char* p, char* pend );
bool hashWords( class HashInfo *hi );
bool hashSingleTerm( int64_t termId, class HashInfo *hi );
bool hashSingleTerm( char *s, int32_t slen, class HashInfo *hi );
bool hashString( class HashTableX *ht, class Bits *bits, char *s, int32_t slen );
bool hashString( char *s, int32_t slen, class HashInfo *hi );
bool hashString( char *s, class HashInfo *hi );
@ -1408,17 +1354,9 @@ public:
uint32_t lastSpideredDate = 0 ,
int32_t injectDocIp = 0 );
bool injectLinks ( HashTableX *linkDedupTable ,
HashTableX *domDedupTable ,
void *finalState ,
void (* finalCallback)(void *));
int64_t logQueryTimingStart();
void logQueryTimingEnd(const char* function, int64_t startTime);
bool doInjectLoop ( );
void doneInjecting ( class XmlDoc *xd );
int32_t m_i;
int32_t m_blocked;
void *m_finalState;