mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +00:00
Additional miscellaneous fixes based on cppcheck static analysis
This commit is contained in:
parent
b2c78dbd57
commit
40e223c12d
5 changed files with 9 additions and 16 deletions
|
@ -761,7 +761,7 @@ void debug_safe(int level, const char *msg, const char *param1, const char *para
|
|||
errno = errno_old;
|
||||
}
|
||||
|
||||
void format_long_safe(char buff[128], long val)
|
||||
void format_long_safe(char buff[64], long val)
|
||||
{
|
||||
if (val == 0)
|
||||
{
|
||||
|
@ -795,7 +795,7 @@ void format_long_safe(char buff[128], long val)
|
|||
}
|
||||
}
|
||||
|
||||
void format_long_safe(wchar_t buff[128], long val)
|
||||
void format_long_safe(wchar_t buff[64], long val)
|
||||
{
|
||||
if (val == 0)
|
||||
{
|
||||
|
|
4
common.h
4
common.h
|
@ -348,8 +348,8 @@ void format_size_safe(char buff[128], unsigned long long sz);
|
|||
void debug_safe(int level, const char *msg, const char *param1 = NULL, const char *param2 = NULL, const char *param3 = NULL, const char *param4 = NULL, const char *param5 = NULL, const char *param6 = NULL, const char *param7 = NULL, const char *param8 = NULL, const char *param9 = NULL, const char *param10 = NULL, const char *param11 = NULL, const char *param12 = NULL);
|
||||
|
||||
/** Writes out a long safely */
|
||||
void format_long_safe(char buff[128], long val);
|
||||
void format_long_safe(wchar_t buff[128], long val);
|
||||
void format_long_safe(char buff[64], long val);
|
||||
void format_long_safe(wchar_t buff[64], long val);
|
||||
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -426,8 +426,6 @@ void env_universal_barrier()
|
|||
|
||||
void env_universal_set(const wcstring &name, const wcstring &value, bool exportv)
|
||||
{
|
||||
message_t *msg;
|
||||
|
||||
if (!s_env_univeral_inited)
|
||||
return;
|
||||
|
||||
|
@ -439,7 +437,7 @@ void env_universal_set(const wcstring &name, const wcstring &value, bool exportv
|
|||
}
|
||||
else
|
||||
{
|
||||
msg = create_message(exportv?SET_EXPORT:SET,
|
||||
message_t *msg = create_message(exportv?SET_EXPORT:SET,
|
||||
name.c_str(),
|
||||
value.c_str());
|
||||
|
||||
|
@ -459,7 +457,6 @@ int env_universal_remove(const wchar_t *name)
|
|||
{
|
||||
int res;
|
||||
|
||||
message_t *msg;
|
||||
if (!s_env_univeral_inited)
|
||||
return 1;
|
||||
|
||||
|
@ -476,7 +473,7 @@ int env_universal_remove(const wchar_t *name)
|
|||
}
|
||||
else
|
||||
{
|
||||
msg= create_message(ERASE, name, 0);
|
||||
message_t *msg = create_message(ERASE, name, 0);
|
||||
msg->count=1;
|
||||
env_universal_server.unsent.push(msg);
|
||||
env_universal_barrier();
|
||||
|
|
|
@ -568,9 +568,6 @@ static void event_fire_internal(const event_t &event)
|
|||
*/
|
||||
static void event_fire_delayed()
|
||||
{
|
||||
|
||||
size_t i;
|
||||
|
||||
/*
|
||||
If is_event is one, we are running the event-handler non-recursively.
|
||||
|
||||
|
@ -582,7 +579,7 @@ static void event_fire_delayed()
|
|||
{
|
||||
event_list_t new_blocked;
|
||||
|
||||
for (i=0; i<blocked.size(); i++)
|
||||
for (size_t i=0; i<blocked.size(); i++)
|
||||
{
|
||||
event_t *e = blocked.at(i);
|
||||
if (event_is_blocked(*e))
|
||||
|
|
|
@ -1433,7 +1433,7 @@ struct autosuggestion_context_t
|
|||
{
|
||||
const completion_t &comp = completions.at(0);
|
||||
size_t cursor = this->cursor_pos;
|
||||
this->autosuggestion = completion_apply_to_command_line(comp.completion.c_str(), comp.flags, this->search_string, &cursor, true /* append only */);
|
||||
this->autosuggestion = completion_apply_to_command_line(comp.completion, comp.flags, this->search_string, &cursor, true /* append only */);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2200,7 +2200,6 @@ static void handle_token_history(int forward, int reset)
|
|||
*/
|
||||
if (data->history_search.go_backwards())
|
||||
{
|
||||
wcstring item = data->history_search.current_string();
|
||||
data->token_history_buff = data->history_search.current_string();
|
||||
}
|
||||
current_pos = data->token_history_buff.size();
|
||||
|
@ -3325,7 +3324,7 @@ const wchar_t *reader_readline(void)
|
|||
{
|
||||
//history_reset();
|
||||
data->history_search.go_to_end();
|
||||
reader_set_buffer(data->search_buff.c_str(), data->search_buff.size());
|
||||
reader_set_buffer(data->search_buff, data->search_buff.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue