Skip to content

Refactor null checks to a better convention #258

@sdimitro

Description

@sdimitro

Currently:

        for msp in metaslabs:
            if msp.ms_sm == sdb.get_typed_null(msp.ms_sm.type_):

Matt's Comment:

It looks like this is the canonical way of doing this, but it seems pretty tricky just to check for null.
As an orthogonal cleanup, maybe we should change this helper function. It looks like all the callers
of get_typed_null(type) could be changed to a simpler-to-use helper, something like:

def is_null(obj: drgn.Object) -> bool:
  return obj == drgn.NULL(prog, obj.type_)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions