Avi Drissman | e4622aa | 2022-09-08 20:36:06 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors |
David Benjamin | 76ee79eb | 2019-03-15 17:02:09 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // This file contains internal routines that are called by other files in |
| 6 | // base/process/. |
| 7 | |
| 8 | #ifndef BASE_PROCESS_ENVIRONMENT_INTERNAL_H_ |
| 9 | #define BASE_PROCESS_ENVIRONMENT_INTERNAL_H_ |
| 10 | |
David Sanders | 6e70994 | 2022-04-05 06:49:26 | [diff] [blame] | 11 | #include "base/base_export.h" |
Maria Kazinova | 112e788 | 2024-06-10 16:04:36 | [diff] [blame^] | 12 | #include "base/containers/heap_array.h" |
David Benjamin | 76ee79eb | 2019-03-15 17:02:09 | [diff] [blame] | 13 | #include "base/environment.h" |
| 14 | #include "build/build_config.h" |
| 15 | |
| 16 | namespace base { |
| 17 | namespace internal { |
| 18 | |
Xiaohan Wang | 37e8161 | 2022-01-15 18:27:00 | [diff] [blame] | 19 | #if BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) |
David Benjamin | 76ee79eb | 2019-03-15 17:02:09 | [diff] [blame] | 20 | // Returns a modified environment vector constructed from the given environment |
| 21 | // and the list of changes given in |changes|. Each key in the environment is |
| 22 | // matched against the first element of the pairs. In the event of a match, the |
| 23 | // value is replaced by the second of the pair, unless the second is empty, in |
| 24 | // which case the key-value is removed. |
| 25 | // |
| 26 | // This POSIX version takes and returns a POSIX-style environment block, which |
| 27 | // is a null-terminated list of pointers to null-terminated strings. The |
| 28 | // returned array will have appended to it the storage for the array itself so |
| 29 | // there is only one pointer to manage, but this means that you can't copy the |
| 30 | // array without keeping the original around. |
Maria Kazinova | 112e788 | 2024-06-10 16:04:36 | [diff] [blame^] | 31 | BASE_EXPORT base::HeapArray<char*> AlterEnvironment( |
David Benjamin | 76ee79eb | 2019-03-15 17:02:09 | [
|