Skip to content

Commit

Permalink
Alright. We'll do our own thing then
Browse files Browse the repository at this point in the history
  • Loading branch information
gnossen committed Aug 31, 2019
1 parent d649880 commit 358676d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/compiler/generator_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,10 @@ inline MethodType GetMethodType(

inline void Split(const grpc::string& s, char delim,
std::vector<grpc::string>* append_to) {
auto current = s.begin();
while (current <= s.end()) {
auto next = std::find(current, s.end(), delim);
append_to->emplace_back(current, next);
current = next + 1;
std::istringstream iss(s);
grpc::string piece;
while (std::getline(iss, piece)) {
append_to->push_back(piece);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/python_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ static bool ParseParameters(const grpc::string& parameter,
std::vector<grpc::string>* strip_prefixes,
grpc::string* error) {
std::vector<grpc::string> comma_delimited_parameters;
grpc_generator::Split(parameter, ',', &comma_delimited_parameters);
grpc_python_generator::Split(parameter, ',', &comma_delimited_parameters);
if (comma_delimited_parameters.empty()) {
*grpc_version = "grpc_2_0";
} else if (comma_delimited_parameters.size() == 1) {
Expand Down
10 changes: 10 additions & 0 deletions src/compiler/python_generator_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ StringVector get_all_comments(const DescriptorType* descriptor) {
return comments;
}

inline void Split(const grpc::string& s, char delim,
std::vector<grpc::string>* append_to) {
auto current = s.begin();
while (current <= s.end()) {
auto next = std::find(current, s.end(), delim);
append_to->emplace_back(current, next);
current = next + 1;
}
}

} // namespace

} // namespace grpc_python_generator
Expand Down

0 comments on commit 358676d

Please sign in to comment.