moved code around to make smallut and pathut less recoll-specific and reusable. No actual changes

This commit is contained in:
Jean-Francois Dockes
2016-03-21 12:55:31 +01:00
parent ef783b3634
commit a4fd4ee5be
26 changed files with 1821 additions and 1493 deletions
+2 -1
View File
@@ -39,6 +39,7 @@
#include "cstr.h"
#include "pathut.h"
#include "rclutil.h"
#include "rclconfig.h"
#include "conftree.h"
#include "debuglog.h"
@@ -144,7 +145,7 @@ RclConfig::RclConfig(const string *argcnf)
}
// Compute our data dir name, typically /usr/local/share/recoll
m_datadir = path_sharedatadir();
m_datadir = path_pkgdatadir();
// We only do the automatic configuration creation thing for the default
// config dir, not if it was specified through -c or RECOLL_CONFDIR
bool autoconfdir = false;
+3 -1
View File
@@ -32,6 +32,7 @@
#include "rclconfig.h"
#include "rclinit.h"
#include "pathut.h"
#include "rclutil.h"
#include "unac.h"
#include "smallut.h"
#include "execmd.h"
@@ -318,6 +319,8 @@ RclConfig *recollinit(RclInitFlags flags,
// Init smallut and pathut static values
pathut_init_mt();
smallut_init_mt();
rclutil_init_mt();
// Init execmd.h static PATH and PATHELT splitting
{string bogus;
ExecCmd::which("nosuchcmd", bogus);
@@ -389,4 +392,3 @@ bool recoll_ismainthread()
return pthread_equal(pthread_self(), mainthread_id);
}
+13 -14
View File
@@ -18,40 +18,39 @@
#define _RCLINIT_H_INCLUDED_
#include <string>
#ifndef NO_NAMESPACES
using std::string;
#endif
class RclConfig;
/**
* Initialize by reading configuration, opening log file, etc.
*
*
* This must be called from the main thread before starting any others. It sets
* up the global signal handling. other threads must call recoll_threadinit()
* when starting.
*
* @param flags misc modifiers. These are currently only used to customize
* @param flags misc modifiers. These are currently only used to customize
* the log file and verbosity.
* @param cleanup function to call before exiting (atexit)
* @param sigcleanup function to call on terminal signal (INT/HUP...) This
* should typically set a flag which tells the program (recoll,
* recollindex etc.. to exit as soon as possible (after closing the db,
* @param sigcleanup function to call on terminal signal (INT/HUP...) This
* should typically set a flag which tells the program (recoll,
* recollindex etc.. to exit as soon as possible (after closing the db,
* etc.). cleanup will then be called by exit().
* @param reason in case of error: output string explaining things
* @param argcnf Configuration directory name from the command line (overriding
* default and environment
* @return the parsed configuration.
*/
enum RclInitFlags {RCLINIT_NONE=0, RCLINIT_DAEMON=1, RCLINIT_IDX=2};
enum RclInitFlags {RCLINIT_NONE = 0, RCLINIT_DAEMON = 1, RCLINIT_IDX = 2};
extern RclConfig *recollinit(RclInitFlags flags,
void (*cleanup)(void), void (*sigcleanup)(int),
string &reason, const string *argcnf = 0);
inline RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
string &reason, const string *argcnf = 0) {
void (*cleanup)(void), void (*sigcleanup)(int),
std::string& reason, const string *argcnf = 0);
inline RclConfig *recollinit(void (*cleanup)(void), void (*sigcleanup)(int),
std::string& reason,
const std::string *argcnf = 0)
{
return recollinit(RCLINIT_NONE, cleanup, sigcleanup, reason, argcnf);
}
// Threads need to call this to block signals.
// Threads need to call this to block signals.
// The main thread handles all signals.
extern void recoll_threadinit();