Skip to content

Commit 4a903e0

Browse files
committed
Remove enum defined in system header.
Since the system header (getopt.h) define these identifiers as macros, it would cause a compiler error (incase the header was included, which it might be due to pre-compiled headers).
1 parent a516836 commit 4a903e0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

OptionParser.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
struct option_t
1010
{
1111
std::string short_option, long_option;
12-
enum { no_argument, optional_argument, required_argument } argument;
12+
int argument;
1313
enum type_t { none, string, integer, plist } type;
1414
char *description;
1515
};

OptionParser.mm

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#import <map>
77
#import <string>
8+
#import <getopt.h>
89
#import "OptionParser.h"
910
#import "Dialog2.h"
1011

@@ -183,10 +184,10 @@ id create_type (std::string const& str, option_t::type_t const& type, NSString**
183184
{
184185
NSString* key = [NSString stringWithUTF8String:it->second->long_option.c_str()];
185186

186-
token_t const& val = tokenizer.get(it->second->argument != option_t::no_argument);
187+
token_t const& val = tokenizer.get(it->second->argument != no_argument);
187188
if(val.type == token_t::value)
188189
{
189-
if(it->second->argument != option_t::no_argument)
190+
if(it->second->argument != no_argument)
190191
{
191192
NSString* err = nil;
192193
if(id value = create_type(val.word, it->second->type, &err))
@@ -195,7 +196,7 @@ id create_type (std::string const& str, option_t::type_t const& type, NSString**
195196
}
196197
else asprintf(&error, "no argument allowed after %s, found %s", t.word.c_str(), val.word.c_str());
197198
}
198-
else if(it->second->argument == option_t::required_argument)
199+
else if(it->second->argument == required_argument)
199200
{
200201
asprintf(&error, "required argument for option %s is missing", t.word.c_str());
201202
}

0 commit comments

Comments
 (0)