fix bugs for linux build

This commit is contained in:
Daniel Larimer 2013-02-09 17:41:44 -05:00
parent 25872b11b8
commit 97e45a64ea
5 changed files with 16 additions and 9 deletions

View file

@ -64,6 +64,7 @@ namespace fc {
value(value&& m );
value(const value& m );
value(const char* c );
value(char* c );
value(int8_t );
value(int16_t );
@ -76,8 +77,6 @@ namespace fc {
value(double );
value(float );
value(bool );
/// initialize an object with a single key/value pair
value(const fc::string&, const value& v );
value(fc::string&& );
value(fc::string& );
value(const fc::string& );
@ -86,6 +85,13 @@ namespace fc {
value(const object& o );
value(object& o );
/// initialize an object with a single key/value pair
value(const fc::string&, const value& v );
template<typename T>
value(const fc::string& s, const T& v ) {
set( s, v );
}
value(fc::vector<value>&& a );
value(fc::vector<value>& a );
value(const fc::vector<value>& a );

View file

@ -9,13 +9,10 @@
#include <fc/console_defines.h>
#include <fc/log.hpp>
#include <fc/value_cast.hpp>
#include <fc/console_appender.hpp>
#include <fc/file_appender.hpp>
namespace fc {
static fc::spin_lock appender_spinlock;
std::unordered_map<std::string,appender::ptr>& get_appender_map() {
static std::unordered_map<std::string,appender::ptr> lm;
return lm;
@ -25,7 +22,6 @@ namespace fc {
return lm;
}
appender::ptr appender::get( const fc::string& s ) {
scoped_lock<spin_lock> lock(appender_spinlock);
return get_appender_map()[s];
}
bool appender::register_appender( const fc::string& type, const appender_factory::ptr& f )
@ -45,6 +41,4 @@ namespace fc {
return ap;
}
static bool reg_console_appender = appender::register_appender<console_appender>( "console" );
static bool reg_file_appender = appender::register_appender<file_appender>( "file" );
} // namespace fc

View file

@ -86,13 +86,13 @@ namespace fc {
void logger::set_name( const fc::string& n ) { my->_name = n; }
const fc::string& logger::name()const { return my->_name; }
static fc::spin_lock logger_spinlock;
std::unordered_map<std::string,logger>& get_logger_map() {
static std::unordered_map<std::string,logger> lm;
return lm;
}
logger logger::get( const fc::string& s ) {
static fc::spin_lock logger_spinlock;
scoped_lock<spin_lock> lock(logger_spinlock);
return get_logger_map()[s];
}

View file

@ -4,6 +4,8 @@
#include <fc/filesystem.hpp>
#include <unordered_map>
#include <string>
#include <fc/console_appender.hpp>
#include <fc/file_appender.hpp>
namespace fc {
std::unordered_map<std::string,logger>& get_logger_map();
@ -16,6 +18,8 @@ namespace fc {
}
bool configure_logging( const logging_config& cfg )
{
static bool reg_console_appender = appender::register_appender<console_appender>( "console" );
static bool reg_file_appender = appender::register_appender<file_appender>( "file" );
get_logger_map().clear();
get_appender_map().clear();

View file

@ -436,6 +436,9 @@ value::value( value&& m ) {
value::value( const value& m ){
gh(m.holder)->copy_helper(holder._store._data);
}
value::value( const char* c ) {
new (holder) detail::value_holder_impl<fc::string>( c );
}
value::value( char* c ) {
new (holder) detail::value_holder_impl<fc::string>( c );
}