Files
llvm/libc/test/integration
Jeff Bailey 56eef98a93 [libc][stdlib] Simplify getenv_test by using strcmp instead of custom helper (#163055)
[libc][stdlib] Simplify getenv_test by using inline_strcmp instead of custom helper

Replace the custom `my_streq` helper function with LLVM libc's
`inline_strcmp` utility from `src/string/memory_utils/inline_strcmp.h`.

Changes:
- Remove 18-line custom `my_streq` implementation
- Use `inline_strcmp` with a simple comparator lambda for string comparisons
- Replace `my_streq(..., nullptr)` checks with direct `== nullptr` comparisons
- Maintain identical test coverage while reducing code duplication

Benefits:
- Uses existing, well-tested LLVM libc infrastructure
- Clearer test assertions with standard comparison functions
- More concise code (reduced from ~48 to ~33 lines)
- Consistent with LLVM libc coding practices

The test continues to verify:
- Empty string handling
- Invalid name handling ('=')
- Missing environment variable queries
- Correct retrieval of existing variables (FRANCE, GERMANY, PATH)
- Partial name matching behavior (FRANC vs FRANCE, FRANCE1 vs FRANCE)
2025-11-13 13:47:07 +00:00
..