Beispiel #1
0
int libc_system_property_foreach(
        void (*propfn)(const prop_info *pi, void *cookie),
        void *cookie)
{
    initialize_properties();

    return mb__system_property_foreach(propfn, cookie);
}
const prop_info *mb__system_property_find_nth(unsigned n)
{
    find_nth_cookie cookie(n);

    const int err = mb__system_property_foreach(find_nth_fn, &cookie);
    if (err < 0) {
        return NULL;
    }

    return cookie.pi;
}
const prop_info* __system_property_find_nth(unsigned n) {
#if !MB_OMIT_API_VERSION_CHECK
  if (bionic_get_application_target_sdk_version() >= __ANDROID_API_O__) {
    __libc_fatal(
        "__system_property_find_nth is not supported since Android O,"
        " please use __system_property_foreach instead.");
  }
#endif

  find_nth_cookie cookie(n);

  const int err = mb__system_property_foreach(find_nth_fn, &cookie);
  if (err < 0) {
    return nullptr;
  }

  return cookie.pi;
}