import re


def fix_varptr_calls(vba_code):
    """
    Change calls like VarPtr(foo(0)) to VarPtr(foo) so we can report on the
    whole byte array.
    """

    # Do we have any VarPtr() calls?
    if ("VarPtr(" not in vba_code):
        return vba_code
    vba_code = re.sub(r"(VarPtr\(\w+)\(0\)\)", r'\1)', vba_code)
    return vba_code