    std::ifstream f(fn);
    return f.good();
  }
  
  std::string getenv_default(const char* env_var, const char * suffix, const char* default_val) {
    const char* env_val = getenv(env_var);
    if (env_val != NULL) {
      return std::string(env_val) + std::string(suffix);
    } else {
      return std::string(default_val);
    }
  }
  
  std::string tohex(const uint8_t *buf, size_t buf_size) {
    std::unique_ptr<char[]> hexbuf(new char[buf_size * 2 + 1]);
    for (size_t i = 0; i < buf_size; i++) {
 
</s> remove std::string getenv_default(const char* env_var, const char* suffix, const char* default_val);
 </s> add std::string getenv(const char* key, const char* default_val = "");
int getenv(const char* key, int default_val);
float getenv(const char* key, float default_val);
 </s> remove const std::string default_params_path = Hardware::PC() ? util::getenv_default("HOME", "/.comma/params", "/data/params")
                                                       : "/data/params";
const std::string persistent_params_path = Hardware::PC() ? default_params_path : "/persist/comma/params";

 </s> add  </s> remove   if (path == default_params_path) {
 </s> add   if (path == Path::params()) { </s> remove const std::string private_key_path =
    Hardware::PC() ? util::getenv_default("HOME", "/.comma/persist/comma/id_rsa", "/persist/comma/id_rsa")
                   : "/persist/comma/id_rsa";

 </s> add  </s> remove   static const int x_min = getenv("XMIN") ? atoi(getenv("XMIN")) : 0;
  static const int y_min = getenv("YMIN") ? atoi(getenv("YMIN")) : 0;
  static const int env_xmax = getenv("XMAX") ? atoi(getenv("XMAX")) : -1;
  static const int env_ymax = getenv("YMAX") ? atoi(getenv("YMAX")) : -1;
  static const int scale = getenv("SCALE") ? atoi(getenv("SCALE")) : 1;
 </s> add   static const int x_min = util::getenv("XMIN", 0);
  static const int y_min = util::getenv("YMIN", 0);
  static const int env_xmax = util::getenv("XMAX", -1);
  static const int env_ymax = util::getenv("YMAX", -1);
  static const int scale = util::getenv("SCALE", 1);
std::string getenv(const char* key, const char* default_val) {
  const char* val = ::getenv(key);
  return val ? val : default_val;
}

int getenv(const char* key, int default_val) {
  const char* val = ::getenv(key);
  return val ? atoi(val) : default_val;
}

float getenv(const char* key, float default_val) {
  const char* val = ::getenv(key);
  return val ? atof(val) : default_val;
    std::ifstream f(fn);
    return f.good();
  }
  
std::string getenv(const char* key, const char* default_val) {
  const char* val = ::getenv(key);
  return val ? val : default_val;
}

int getenv(const char* key, int default_val) {
  const char* val = ::getenv(key);
  return val ? atoi(val) : default_val;
}

float getenv(const char* key, float default_val) {
  const char* val = ::getenv(key);
  return val ? atof(val) : default_val;
std::string getenv(const char* key, const char* default_val) {
  const char* val = ::getenv(key);
  return val ? val : default_val;
}

int getenv(const char* key, int default_val) {
  const char* val = ::getenv(key);
  return val ? atoi(val) : default_val;
}

float getenv(const char* key, float default_val) {
  const char* val = ::getenv(key);
  return val ? atof(val) : default_val;
std::string getenv(const char* key, const char* default_val) {
  const char* val = ::getenv(key);
  return val ? val : default_val;
}

int getenv(const char* key, int default_val) {
  const char* val = ::getenv(key);
  return val ? atoi(val) : default_val;
}

float getenv(const char* key, float default_val) {
  const char* val = ::getenv(key);
  return val ? atof(val) : default_val;
std::string getenv(const char* key, const char* default_val) {
  const char* val = ::getenv(key);
  return val ? val : default_val;
}

int getenv(const char* key, int default_val) {
  const char* val = ::getenv(key);
  return val ? atoi(val) : default_val;
}

float getenv(const char* key, float default_val) {
  const char* val = ::getenv(key);
  return val ? atof(val) : default_val;
std::string getenv(const char* key, const char* default_val) {
  const char* val = ::getenv(key);
  return val ? val : default_val;
}

int getenv(const char* key, int default_val) {
  const char* val = ::getenv(key);
  return val ? atoi(val) : default_val;
}

float getenv(const char* key, float default_val) {
  const char* val = ::getenv(key);
  return val ? atof(val) : default_val;
std::string getenv(const char* key, const char* default_val) {
  const char* val = ::getenv(key);
  return val ? val : default_val;
}

int getenv(const char* key, int default_val) {
  const char* val = ::getenv(key);
  return val ? atoi(val) : default_val;
}

float getenv(const char* key, float default_val) {
  const char* val = ::getenv(key);
  return val ? atof(val) : default_val;
std::string getenv(const char* key, const char* default_val) {
  const char* val = ::getenv(key);
  return val ? val : default_val;
}

int getenv(const char* key, int default_val) {
  const char* val = ::getenv(key);
  return val ? atoi(val) : default_val;
}

float getenv(const char* key, float default_val) {
  const char* val = ::getenv(key);
  return val ? atof(val) : default_val;
  }
  
  std::string tohex(const uint8_t *buf, size_t buf_size) {
    std::unique_ptr<char[]> hexbuf(new char[buf_size * 2 + 1]);
    for (size_t i = 0; i < buf_size; i++) {
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
 hw.h: move Hardware-related paths to namespace Path (#21826)

* refactor getenv and path

* apply review 
selfdrive/common/util.cc