Breaking: YGConfigRef related const-correctness fixes (#1371)
Summary: X-link: https://github.com/facebook/react-native/pull/39374 Pull Request resolved: https://github.com/facebook/yoga/pull/1371 Right now `YGConfigGetDefault` and `YGNodeGetConfig` both return mutable, freeable, configs, which is bad, since the former points to a global singleton config, and the latter usually does too. Mutating this is not thread safe, and it should never be freed. This change makes these functions return `YGConfigConstRef` to prevent mutation, and also lets us allow `YGConfigNewWithConfig` to accept a const config. If a caller does want to mutate a config (such as to free it), it must be tracked manually. Changelog: [Internal] Reviewed By: javache Differential Revision: D49132476 fbshipit-source-id: ac9ce61149e69c6c25cadb99711435b0a5b9f38a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a003c09a4c
commit
0720e0b22a
@@ -22,10 +22,11 @@ void vlog(
|
||||
void* context,
|
||||
const char* format,
|
||||
va_list args) {
|
||||
const yoga::Config* logConfig =
|
||||
config != nullptr ? config : resolveRef(YGConfigGetDefault());
|
||||
|
||||
logConfig->log(const_cast<yoga::Node*>(node), level, context, format, args);
|
||||
if (config == nullptr) {
|
||||
getDefaultLogger()(nullptr, node, level, format, args);
|
||||
} else {
|
||||
config->log(node, level, context, format, args);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
Reference in New Issue
Block a user