typefindhelper: Avoid using buffer_get_size in tight loops