Skip to content

Commit

Permalink
fix double backslash
Browse files Browse the repository at this point in the history
  • Loading branch information
sgatto committed Sep 23, 2024
1 parent b558e44 commit 350ecdf
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
shell: bash
run: |
OR_REPO="https://github.com/google/or-tools.git"
OR_REF="9.11"
OR_REF="v9.11"
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV
echo "OR_REF=$OR_REF" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/oracle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
shell: bash
run: |
OR_REPO="https://github.com/google/or-tools.git"
OR_REF="9.11"
OR_REF="v9.11"
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV
echo "OR_REF=$OR_REF" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
shell: bash
run: |
OR_REPO="https://github.com/google/or-tools.git"
OR_REF="9.11"
OR_REF="v9.11"
echo "OR_REPO=$OR_REPO" >> $GITHUB_ENV
echo "OR_REF=$OR_REF" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: google/or-tools
ref: "9.11"
ref: "v9.11"

- name: Checkout this repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: google/or-tools
ref: "9.11"
ref: "v9.11"

- name: Checkout this repository
uses: actions/checkout@v4
Expand Down
70 changes: 34 additions & 36 deletions patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,7 @@

replacements.append(Replacement(
Path.cwd()/'ortools'/'linear_solver'/'xpress_interface.cc',
''' }
}
const char* stringToCharPtr(std::string& var) { return var.c_str(); }
'''const char* stringToCharPtr(std::string& var) { return var.c_str(); }
// Save the existing locale, use the "C" locale to ensure that
// string -> double conversion is done ignoring the locale.
Expand All @@ -227,44 +224,45 @@
CHECK_EQ(std::string(newLocale), "C");
}
~ScopedLocale() { std::setlocale(LC_NUMERIC, oldLocale); }
''',
'''bool stringToCharPtr(const std::string& var, const char** out) {
*out = var.c_str();
return true;
}
'''
))

private:
replacements.append(Replacement(
Path.cwd()/'ortools'/'linear_solver'/'xpress_interface.cc',
''' private:
const char* oldLocale;
};
#define setParamIfPossible_MACRO(target_map, setter, converter) \
{ \
auto matchingParamIter = (target_map).find(paramAndValuePair.first); \
if (matchingParamIter != (target_map).end()) { \
const auto convertedValue = converter(paramAndValuePair.second); \
VLOG(1) << "Setting parameter " << paramAndValuePair.first \
<< " to value " << convertedValue << std::endl; \
setter(mLp, matchingParamIter->second, convertedValue); \
continue; \
} \
#define setParamIfPossible_MACRO(target_map, setter, converter) \\
{ \\
auto matchingParamIter = (target_map).find(paramAndValuePair.first); \\
if (matchingParamIter != (target_map).end()) { \\
const auto convertedValue = converter(paramAndValuePair.second); \\
VLOG(1) << "Setting parameter " << paramAndValuePair.first \\
<< " to value " << convertedValue << std::endl; \\
setter(mLp, matchingParamIter->second, convertedValue); \\
continue; \\
} \\
}
''',
''' }
}
bool stringToCharPtr(const std::string& var, const char** out) {
*out = var.c_str();
return true;
}
#define setParamIfPossible_MACRO(target_map, setter, converter, type) \
{ \
auto matchingParamIter = (target_map).find(paramAndValuePair.first); \
if (matchingParamIter != (target_map).end()) { \
type convertedValue; \
bool ret = converter(paramAndValuePair.second, &convertedValue); \
if (ret) { \
VLOG(1) << "Setting parameter " << paramAndValuePair.first \
<< " to value " << convertedValue << std::endl; \
} \
setter(mLp, matchingParamIter->second, convertedValue); \
continue; \
} \
'''#define setParamIfPossible_MACRO(target_map, setter, converter, type) \\
{ \\
auto matchingParamIter = (target_map).find(paramAndValuePair.first); \\
if (matchingParamIter != (target_map).end()) { \\
type convertedValue; \\
bool ret = converter(paramAndValuePair.second, &convertedValue); \\
if (ret) { \\
VLOG(1) << "Setting parameter " << paramAndValuePair.first \\
<< " to value " << convertedValue << std::endl; \\
} \\
setter(mLp, matchingParamIter->second, convertedValue); \\
continue; \\
} \\
}
'''
))
Expand Down

0 comments on commit 350ecdf

Please sign in to comment.