util/OptionParser: make string pointers "const"

This commit is contained in:
Max Kellermann 2018-01-16 10:17:09 +01:00
parent 36a6405e8b
commit 4a304bf34e
2 changed files with 6 additions and 6 deletions

View File

@ -40,7 +40,7 @@ bool
OptionParser::ParseNext() noexcept
{
assert(HasEntries());
char *arg = *argv;
const char *arg = *argv;
++argv;
--argc;
if (arg[0] == '-') {

View File

@ -30,16 +30,16 @@ class OptionDef;
class OptionParser
{
int argc;
char **argv;
char *option = nullptr;
char *option_raw = nullptr;
char *const*argv;
const char *option = nullptr;
const char *option_raw = nullptr;
bool is_long = false;
public:
/**
* Constructs #OptionParser.
*/
constexpr OptionParser(int _argc, char **_argv) noexcept
constexpr OptionParser(int _argc, char *const*_argv) noexcept
:argc(_argc - 1), argv(_argv + 1) {}
/**
@ -52,7 +52,7 @@ public:
/**
* Gets the last parsed option.
*/
char *GetOption() noexcept {
const char *GetOption() noexcept {
assert(option_raw != nullptr);
return option_raw;
}