Works around a VC bug by avoiding defining a function named strdup().

This commit is contained in:
zhanyong.wan
2009-03-26 21:11:22 +00:00
parent 3c7bbf5b46
commit e120fc5890
3 changed files with 12 additions and 7 deletions

View File

@@ -810,7 +810,7 @@ class Arguments {
}
}
void AddArgument(const char* argument) {
args_.insert(args_.end() - 1, strdup(argument));
args_.insert(args_.end() - 1, posix::StrDup(argument));
}
template <typename Str>
@@ -818,7 +818,7 @@ class Arguments {
for (typename ::std::vector<Str>::const_iterator i = arguments.begin();
i != arguments.end();
++i) {
args_.insert(args_.end() - 1, strdup(i->c_str()));
args_.insert(args_.end() - 1, posix::StrDup(i->c_str()));
}
}
char* const* Argv() {

View File

@@ -98,7 +98,7 @@ bool RE::PartialMatch(const char* str, const RE& re) {
// Initializes an RE from its string representation.
void RE::Init(const char* regex) {
pattern_ = strdup(regex);
pattern_ = posix::StrDup(regex);
// Reserves enough bytes to hold the regular expression used for a
// full match.
@@ -346,7 +346,7 @@ bool RE::PartialMatch(const char* str, const RE& re) {
void RE::Init(const char* regex) {
pattern_ = full_pattern_ = NULL;
if (regex != NULL) {
pattern_ = posix::strdup(regex);
pattern_ = posix::StrDup(regex);
}
is_valid_ = ValidateRegex(regex);