getMainConfig not actually needed and possibly harmful

This commit is contained in:
dockes 2008-12-19 09:55:36 +00:00
parent 0821f0cc29
commit d9b9b41a9d
3 changed files with 8 additions and 7 deletions

View File

@ -16,7 +16,7 @@
*/
#ifndef _DB_H_INCLUDED_
#define _DB_H_INCLUDED_
/* @(#$Id: rcldb.h,v 1.64 2008-12-17 08:01:40 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: rcldb.h,v 1.65 2008-12-19 09:55:36 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include <list>
@ -187,7 +187,9 @@ class Db {
/** Test if terms stem to different roots. */
bool stemDiffers(const string& lang, const string& term,
const string& base);
RclConfig *getConf() {return m_config;}
/* This has to be public for access by embedded Query::Native */
Native *m_ndb;

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclquery.cpp,v 1.10 2008-10-07 06:44:23 dockes Exp $ (C) 2008 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclquery.cpp,v 1.11 2008-12-19 09:55:36 dockes Exp $ (C) 2008 J.F.Dockes";
#endif
#include <stdlib.h>
@ -113,8 +113,7 @@ Db *Query::whatDb()
}
void Query::setSortBy(const string& fld, bool ascending) {
RclConfig *cfg = RclConfig::getMainConfig();
m_sortField = cfg->fieldCanon(fld);
m_sortField = m_db->getConf()->fieldCanon(fld);
m_sortAscending = ascending;
LOGDEB0(("RclQuery::setSortBy: [%s] %s\n", m_sortField.c_str(),
m_sortAscending ? "ascending" : "descending"));

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: searchdata.cpp,v 1.31 2008-12-19 09:44:39 dockes Exp $ (C) 2006 J.F.Dockes";
static char rcsid[] = "@(#$Id: searchdata.cpp,v 1.32 2008-12-19 09:55:36 dockes Exp $ (C) 2006 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -100,7 +100,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
vector<string> exptps;
exptps.reserve(m_filetypes.size());
// Expand categories
RclConfig *cfg = RclConfig::getMainConfig();
RclConfig *cfg = db.getConf();
for (vector<string>::iterator it = m_filetypes.begin();
it != m_filetypes.end(); it++) {
if (cfg && cfg->isMimeCategory(*it)) {