Minor code cleanups
This commit is contained in:
parent
5dfd4a9869
commit
af8e8d27d4
|
@ -31,9 +31,11 @@ void CommandManager::register_commands(memoryview<String> command_names,
|
|||
m_commands[command_name] = { command, completer };
|
||||
}
|
||||
|
||||
parse_error::parse_error(const String& error)
|
||||
struct parse_error : runtime_error
|
||||
{
|
||||
parse_error(const String& error)
|
||||
: runtime_error{"parse error: " + error} {}
|
||||
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
|
@ -14,15 +14,9 @@
|
|||
namespace Kakoune
|
||||
{
|
||||
|
||||
struct parse_error : runtime_error
|
||||
{
|
||||
parse_error(const String& error);
|
||||
};
|
||||
|
||||
struct Context;
|
||||
using CommandParameters = memoryview<String>;
|
||||
using Command = std::function<void (CommandParameters,
|
||||
Context& context)>;
|
||||
using Command = std::function<void (CommandParameters, Context& context)>;
|
||||
using CommandCompleter = std::function<CandidateList (const Context& context,
|
||||
CommandParameters,
|
||||
size_t, ByteCount)>;
|
||||
|
|
|
@ -43,7 +43,7 @@ String runtime_directory()
|
|||
#elif defined(__APPLE__)
|
||||
uint32_t bufsize = 2048;
|
||||
_NSGetExecutablePath(buffer, &bufsize);
|
||||
char* canonical_path = realpath(buffer, NULL);
|
||||
char* canonical_path = realpath(buffer, nullptr);
|
||||
strncpy(buffer, canonical_path, 2048);
|
||||
free(canonical_path);
|
||||
#else
|
||||
|
|
|
@ -327,7 +327,7 @@ bool RemoteUI::is_key_available()
|
|||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
int res = select(sock+1, &rfds, NULL, NULL, &tv);
|
||||
int res = select(sock+1, &rfds, nullptr, nullptr, &tv);
|
||||
return res == 1;
|
||||
}
|
||||
|
||||
|
@ -500,7 +500,7 @@ private:
|
|||
FD_ZERO(&rfds);
|
||||
FD_SET(socket, &rfds);
|
||||
}
|
||||
while (select(socket+1, &rfds, NULL, NULL, &tv) == 1);
|
||||
while (select(socket+1, &rfds, nullptr, nullptr, &tv) == 1);
|
||||
}
|
||||
|
||||
String m_buffer;
|
||||
|
|
|
@ -67,7 +67,7 @@ String ShellManager::pipe(const String& input,
|
|||
if (not errorout.empty())
|
||||
write_debug("shell stderr: <<<\n" + errorout + ">>>");
|
||||
|
||||
waitpid(pid, NULL, 0);
|
||||
waitpid(pid, nullptr, 0);
|
||||
}
|
||||
else try
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ String ShellManager::pipe(const String& input,
|
|||
execparams.push_back(shell.c_str());
|
||||
for (auto& param : params)
|
||||
execparams.push_back(param.c_str());
|
||||
execparams.push_back(NULL);
|
||||
execparams.push_back(nullptr);
|
||||
|
||||
execvp(shell.c_str(), (char* const*)execparams.data());
|
||||
exit(-1);
|
||||
|
|
Loading…
Reference in New Issue
Block a user