Skip to content

Commit 2cc4efe

Browse files
committed
Update on "[1/N] Add BackendOptions class"
Introduce backend option as discussed in #10216 Step 1: Introducd Backend Option class In later stage, it will be plugged in with the rest of the stack. BackendOptions is pretty much a list of BackendOption, and backend option is a key value pair. The key is a string, and the value can be 3 different types, including bool, string and int. Differential Revision: [D75993712](https://our.internmc.facebook.com/intern/diff/D75993712/) Differential Revision: [D75993712](https://our.internmc.facebook.com/intern/diff/D75993712) [ghstack-poisoned]
2 parents c73309f + 38c8367 commit 2cc4efe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

runtime/backend/options.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ using OptionValue =
2929
struct BackendOption {
3030
// key is the name of the backend option, like num_threads, enable_profiling,
3131
// etc
32-
char key[kMaxOptionKeyLength];
32+
char key[kMaxOptionKeyLength]{};
3333
// value is the value of the backend option, like 4, true, etc
3434
OptionValue value;
3535
};
@@ -129,7 +129,7 @@ class BackendOptions {
129129
Error set_option(const char (&key)[N], const char* value) noexcept {
130130
static_assert(N <= kMaxOptionKeyLength, "Option key is too long");
131131
// Create a fixed-size array and copy the string
132-
std::array<char, kMaxOptionValueLength> arr;
132+
std::array<char, kMaxOptionValueLength> arr{};
133133
strncpy(arr.data(), value, kMaxOptionValueLength - 1);
134134
arr[kMaxOptionValueLength - 1] = '\0'; // Ensure null termination
135135
return set_option_impl(key, arr);

0 commit comments

Comments
 (0)