Ejemplo n.º 1
0
bool operator == (const CommandInfo& left, const CommandInfo& right)
{
    if (left.uris().size() != right.uris().size()) {
        return false;
    }

    // TODO(vinod): Factor out the comparison for repeated fields.
    for (int i = 0; i < left.uris().size(); i++) {
        bool found = false;
        for (int j = 0; j < right.uris().size(); j++) {
            if (left.uris().Get(i) == right.uris().Get(j)) {
                found = true;
                break;
            }
        }
        if (!found) {
            return false;
        }
    }

    if (left.arguments().size() != right.arguments().size()) {
        return false;
    }

    // The order of argv is important.
    for (int i = 0; i < left.arguments().size(); i++) {
        if (left.arguments().Get(i) != right.arguments().Get(i)) {
            return false;
        }
    }

    // NOTE: We are not validating CommandInfo::ContainerInfo here
    // because it is being deprecated in favor of ContainerInfo.
    // TODO(vinod): Kill the above comment when
    // CommandInfo::ContainerInfo is removed.
    return left.environment() == right.environment() &&
           left.value() == right.value() &&
           left.user() == right.user() &&
           left.shell() == right.shell();
}
Ejemplo n.º 2
0
inline bool operator == (const CommandInfo& left, const CommandInfo& right)
{
  if (left.uris().size() != right.uris().size()) {
    return false;
  }

  for (int i=0; i<left.uris().size(); i++) {
    bool found = false;
    for (int j=0; j<right.uris().size(); j++) {
      if (left.uris().Get(i) == right.uris().Get(j)) {
        found = true;
        break;
      }
    }
    if (!found) {
      return false;
    }
  }

  return left.has_environment() == right.has_environment() &&
    (!left.has_environment() || (left.environment() == right.environment())) &&
    left.value() == right.value();
}