Skip to content

[lldb][OpenBSD] Make use of Environment class #122040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

brad0
Copy link
Contributor

@brad0 brad0 commented Jan 8, 2025

No description provided.

@brad0 brad0 requested a review from JDevlieghere as a code owner January 8, 2025 02:23
@llvmbot llvmbot added the lldb label Jan 8, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 8, 2025

@llvm/pr-subscribers-lldb

Author: Brad Smith (brad0)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/122040.diff

1 Files Affected:

  • (modified) lldb/source/Host/openbsd/Host.cpp (+1-12)
diff --git a/lldb/source/Host/openbsd/Host.cpp b/lldb/source/Host/openbsd/Host.cpp
index a4dc3918acfd08..e7ad18e03e19b3 100644
--- a/lldb/source/Host/openbsd/Host.cpp
+++ b/lldb/source/Host/openbsd/Host.cpp
@@ -41,18 +41,7 @@ namespace lldb_private {
 class ProcessLaunchInfo;
 }
 
-Environment Host::GetEnvironment() {
-  Environment env;
-  char *v;
-  char **var = environ;
-  for (; var != NULL && *var != NULL; ++var) {
-    v = strchr(*var, (int)'-');
-    if (v == NULL)
-      continue;
-    env.insert(v);
-  }
-  return env;
-}
+Environment Host::GetEnvironment() { return Environment(environ); }
 
 static bool
 GetOpenBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr,

@brad0 brad0 requested a review from DavidSpickett January 8, 2025 02:24
Copy link
Collaborator

@labath labath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you feel up to it, you could also put into the common code (under #if !APPLE && !WINDOWS) and delete the implementations in other OSes as well.

@brad0 brad0 merged commit 647e8d8 into llvm:main Jan 8, 2025
9 checks passed
@brad0 brad0 deleted the lldb_openbsd_environment branch January 8, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants