[keel,nostalgia,studio] Make keel use references in place of a lot of pointers

This commit is contained in:
2023-11-30 23:11:49 -06:00
parent 95ba8eb138
commit 232a166833
22 changed files with 162 additions and 160 deletions
+6 -6
View File
@@ -12,12 +12,12 @@ namespace keel {
#ifndef OX_BARE_METAL
[[nodiscard]]
static ox::Result<const BaseConverter*> findConverter(
keel::Context *ctx,
keel::Context &ctx,
ox::CRStringView srcTypeName,
int srcTypeVersion,
ox::CRStringView dstTypeName,
int dstTypeVersion) noexcept {
for (auto &c : ctx->converters) {
for (auto &c : ctx.converters) {
if (c->matches(srcTypeName, srcTypeVersion, dstTypeName, dstTypeVersion)) {
return c;
}
@@ -26,7 +26,7 @@ static ox::Result<const BaseConverter*> findConverter(
};
static ox::Result<ox::UniquePtr<Wrap>> convert(
[[maybe_unused]] keel::Context *ctx,
[[maybe_unused]] keel::Context &ctx,
[[maybe_unused]] const ox::Buffer &srcBuffer,
[[maybe_unused]] ox::CRStringView srcTypeName,
[[maybe_unused]] int srcTypeVersion,
@@ -38,7 +38,7 @@ static ox::Result<ox::UniquePtr<Wrap>> convert(
return c->convertBuffToPtr(ctx, srcBuffer);
}
// try to chain multiple converters
for (const auto &subConverter : ctx->converters) {
for (const auto &subConverter : ctx.converters) {
if (!subConverter->dstMatches(dstTypeName, dstTypeVersion)) {
continue;
}
@@ -46,7 +46,7 @@ static ox::Result<ox::UniquePtr<Wrap>> convert(
convert(ctx, srcBuffer, srcTypeName, srcTypeVersion,
subConverter->srcTypeName(), subConverter->srcTypeVersion());
if (!chainErr) {
return subConverter->convertPtrToPtr(ctx, intermediate.get());
return subConverter->convertPtrToPtr(ctx, *intermediate);
}
}
return OxError(1, "Could not convert between types");
@@ -54,7 +54,7 @@ static ox::Result<ox::UniquePtr<Wrap>> convert(
#endif
ox::Result<ox::UniquePtr<Wrap>> convert(
[[maybe_unused]] keel::Context *ctx,
[[maybe_unused]] keel::Context &ctx,
[[maybe_unused]] const ox::Buffer &srcBuffer,
[[maybe_unused]] ox::CRStringView dstTypeName,
[[maybe_unused]] int dstTypeVersion) noexcept {