Remove libcstr
The `cstr!` macro is redundant, since `cstr!("foo")` can be written
instead as `c"foo"`. All known usages of it were removed in
commit f46a17c5595017c4e7ca9b18b2c5d12c2b7b7f3e.
So now remove the library itself.
Test: Presubmits
Change-Id: I3f4cec3636aa035e15c0dbd2b2779b31a9ea967a
diff --git a/libs/cstr/Android.bp b/libs/cstr/Android.bp
deleted file mode 100644
index 4ea87df..0000000
--- a/libs/cstr/Android.bp
+++ /dev/null
@@ -1,36 +0,0 @@
-package {
- default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-rust_library_rlib {
- name: "libcstr",
- crate_name: "cstr",
- defaults: ["avf_build_flags_rust"],
- srcs: ["src/lib.rs"],
- edition: "2021",
- host_supported: true,
- prefer_rlib: true,
- target: {
- android: {
- no_stdlibs: true,
- stdlibs: [
- "libcompiler_builtins.rust_sysroot",
- "libcore.rust_sysroot",
- ],
- },
- },
- apex_available: [
- "//apex_available:platform",
- "//apex_available:anyapex",
- ],
-}
-
-rust_test {
- name: "libcstr.tests",
- crate_name: "libcstr_test",
- defaults: ["avf_build_flags_rust"],
- srcs: ["src/lib.rs"],
- test_suites: ["general-tests"],
- prefer_rlib: true,
- rustlibs: ["libcstr"],
-}
diff --git a/libs/cstr/rules.mk b/libs/cstr/rules.mk
deleted file mode 100644
index 2309c30..0000000
--- a/libs/cstr/rules.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright (C) 2024 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_DIR := $(GET_LOCAL_DIR)
-
-MODULE := $(LOCAL_DIR)
-
-SRC_DIR := packages/modules/Virtualization/libs/cstr
-
-MODULE_SRCS := $(SRC_DIR)/src/lib.rs
-
-MODULE_CRATE_NAME := cstr
-
-MODULE_RUST_EDITION := 2021
-
-include make/library.mk
diff --git a/libs/cstr/src/lib.rs b/libs/cstr/src/lib.rs
deleted file mode 100644
index ddf20fc..0000000
--- a/libs/cstr/src/lib.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2023, The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//! Provide a safe const-compatible no_std macro for readable &'static CStr.
-
-#![no_std]
-
-/// Create &CStr out of &str literal
-#[macro_export]
-macro_rules! cstr {
- ($str:literal) => {{
- const S: &str = concat!($str, "\0");
- const C: &::core::ffi::CStr = match ::core::ffi::CStr::from_bytes_with_nul(S.as_bytes()) {
- Ok(v) => v,
- Err(_) => panic!("string contains interior NUL"),
- };
- C
- }};
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use std::ffi::CString;
-
- #[test]
- fn valid_input_string() {
- let expected = CString::new("aaa").unwrap();
- assert_eq!(cstr!("aaa"), expected.as_c_str());
- }
-
- #[test]
- fn valid_empty_string() {
- let expected = CString::new("").unwrap();
- assert_eq!(cstr!(""), expected.as_c_str());
- }
-
- // As cstr!() panics at compile time, tests covering invalid inputs fail to compile!
-}
diff --git a/libs/libfdt/rules.mk b/libs/libfdt/rules.mk
index 2b4e470..ce8aa51 100644
--- a/libs/libfdt/rules.mk
+++ b/libs/libfdt/rules.mk
@@ -27,7 +27,6 @@
MODULE_LIBRARY_DEPS += \
external/dtc/libfdt \
- packages/modules/Virtualization/libs/cstr \
packages/modules/Virtualization/libs/libfdt/bindgen \
$(call FIND_CRATE,zerocopy) \
$(call FIND_CRATE,static_assertions) \