always return const pointer from functions - these strings are not planned to be modified
This commit is contained in:
parent
cb366e00c5
commit
039326d0c9
@ -277,8 +277,8 @@ public:
|
||||
assert (loglev >= 0 && loglev < N_LOGLEV);
|
||||
onoff[loglev] = value;
|
||||
}
|
||||
char *get_name() { return name; }
|
||||
char *getprefix() { return prefix; }
|
||||
const char *get_name() { return name; }
|
||||
const char *getprefix() { return prefix; }
|
||||
int getonoff(int level) {
|
||||
assert (level>=0 && level<N_LOGLEV);
|
||||
return onoff[level];
|
||||
@ -325,7 +325,7 @@ public:
|
||||
void remove_logfn(logfunc_t *fn);
|
||||
void set_log_action(int loglevel, int action);
|
||||
const char *getlevel(int i);
|
||||
char *getaction(int i);
|
||||
const char *getaction(int i);
|
||||
|
||||
protected:
|
||||
int n_logfn;
|
||||
|
@ -89,12 +89,12 @@ public:
|
||||
virtual bx_param_enum_c *get_param_enum(const char *pname, bx_param_c *base=NULL);
|
||||
virtual Bit32u gen_param_id() { return param_id++; }
|
||||
virtual int get_n_log_modules();
|
||||
virtual char *get_logfn_name(int mod);
|
||||
virtual const char *get_logfn_name(int mod);
|
||||
virtual int get_logfn_id(const char *name);
|
||||
virtual char *get_prefix(int mod);
|
||||
virtual const char *get_prefix(int mod);
|
||||
virtual int get_log_action(int mod, int level);
|
||||
virtual void set_log_action(int mod, int level, int action);
|
||||
virtual char *get_action_name(int action);
|
||||
virtual const char *get_action_name(int action);
|
||||
virtual int get_default_log_action(int level) {
|
||||
return logfunctions::get_default_action(level);
|
||||
}
|
||||
@ -343,7 +343,7 @@ int bx_real_sim_c::get_n_log_modules()
|
||||
return io->get_n_logfns();
|
||||
}
|
||||
|
||||
char *bx_real_sim_c::get_logfn_name(int mod)
|
||||
const char *bx_real_sim_c::get_logfn_name(int mod)
|
||||
{
|
||||
logfunc_t *logfn = io->get_logfn(mod);
|
||||
return logfn->get_name();
|
||||
@ -364,7 +364,7 @@ int bx_real_sim_c::get_logfn_id(const char *name)
|
||||
return id;
|
||||
}
|
||||
|
||||
char *bx_real_sim_c::get_prefix(int mod)
|
||||
const char *bx_real_sim_c::get_prefix(int mod)
|
||||
{
|
||||
logfunc_t *logfn = io->get_logfn(mod);
|
||||
return logfn->getprefix();
|
||||
@ -385,12 +385,12 @@ void bx_real_sim_c::set_log_action(int mod, int level, int action)
|
||||
return;
|
||||
}
|
||||
// if called with mod<0 loop over all
|
||||
int nmod = get_n_log_modules ();
|
||||
int nmod = get_n_log_modules();
|
||||
for (mod=0; mod<nmod; mod++)
|
||||
set_log_action(mod, level, action);
|
||||
}
|
||||
|
||||
char *bx_real_sim_c::get_action_name(int action)
|
||||
const char *bx_real_sim_c::get_action_name(int action)
|
||||
{
|
||||
return io->getaction(action);
|
||||
}
|
||||
|
@ -603,14 +603,14 @@ public:
|
||||
virtual bx_param_enum_c *get_param_enum(const char *pname, bx_param_c *base=NULL) {return NULL;}
|
||||
virtual unsigned gen_param_id() {return 0;}
|
||||
virtual int get_n_log_modules() {return -1;}
|
||||
virtual char *get_logfn_name(int mod) {return 0;}
|
||||
virtual const char *get_logfn_name(int mod) {return 0;}
|
||||
virtual int get_logfn_id(const char *name) {return -1;}
|
||||
virtual char *get_prefix(int mod) {return 0;}
|
||||
virtual const char *get_prefix(int mod) {return 0;}
|
||||
virtual int get_log_action(int mod, int level) {return -1;}
|
||||
virtual void set_log_action(int mod, int level, int action) {}
|
||||
virtual int get_default_log_action(int level) {return -1;}
|
||||
virtual void set_default_log_action(int level, int action) {}
|
||||
virtual char *get_action_name(int action) {return 0;}
|
||||
virtual const char *get_action_name(int action) {return 0;}
|
||||
virtual const char *get_log_level_name(int level) {return 0;}
|
||||
virtual int get_max_log_level() {return -1;}
|
||||
|
||||
|
@ -46,7 +46,7 @@ const char* iofunctions::getlevel(int i)
|
||||
else return "?";
|
||||
}
|
||||
|
||||
char* iofunctions::getaction(int i)
|
||||
const char* iofunctions::getaction(int i)
|
||||
{
|
||||
static const char *name[] = { "ignore", "report", "ask", "fatal" };
|
||||
assert (i>=ACT_IGNORE && i<N_ACT);
|
||||
|
Loading…
Reference in New Issue
Block a user