From 005d75e6b24e3d5abcead2686d35dcc7e079c363 Mon Sep 17 00:00:00 2001 From: gitamohr Date: Thu, 16 Nov 2023 11:20:30 -0800 Subject: [PATCH] pcp: Eliminate some redundant pointer validity checking in _ScanArcs(). (Internal change: 2305555) --- pxr/usd/pcp/primIndex.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pxr/usd/pcp/primIndex.cpp b/pxr/usd/pcp/primIndex.cpp index 80ce1df1f5..cab1e03d70 100644 --- a/pxr/usd/pcp/primIndex.cpp +++ b/pxr/usd/pcp/primIndex.cpp @@ -664,22 +664,23 @@ _ScanArcs(PcpNodeRef const& node) size_t arcs = 0; SdfPath const& path = node.GetPath(); for (SdfLayerRefPtr const& layer: node.GetLayerStack()->GetLayers()) { - if (!layer->HasSpec(path)) { + SdfLayer const *layerPtr = get_pointer(layer); + if (!layerPtr->HasSpec(path)) { continue; } - if (layer->HasField(path, SdfFieldKeys->InheritPaths)) { + if (layerPtr->HasField(path, SdfFieldKeys->InheritPaths)) { arcs |= _ArcFlagInherits; } - if (layer->HasField(path, SdfFieldKeys->VariantSetNames)) { + if (layerPtr->HasField(path, SdfFieldKeys->VariantSetNames)) { arcs |= _ArcFlagVariants; } - if (layer->HasField(path, SdfFieldKeys->References)) { + if (layerPtr->HasField(path, SdfFieldKeys->References)) { arcs |= _ArcFlagReferences; } - if (layer->HasField(path, SdfFieldKeys->Payload)) { + if (layerPtr->HasField(path, SdfFieldKeys->Payload)) { arcs |= _ArcFlagPayloads; } - if (layer->HasField(path, SdfFieldKeys->Specializes)) { + if (layerPtr->HasField(path, SdfFieldKeys->Specializes)) { arcs |= _ArcFlagSpecializes; } }