lib/macho/macho_file.rb
# Delete a load command from the Mach-O.
# @param lc [LoadCommands::LoadCommand] the load command being deleted
# @param options [Hash]
# @option options [Boolean] :repopulate (true) whether or not to repopulate
#  the instance fields
# @return [void]
# @note This is public, but methods like {#delete_rpath} should be preferred.
#  Setting `repopulate` to false **will leave the instance in an
#  inconsistent state** unless {#populate_fields} is called **immediately**
#  afterwards.
Delete a load command from the Mach-O.
Delete a load command from the Mach - O .
def delete_command(lc, options = {})
      @raw_data.slice!(lc.view.offset, lc.cmdsize)
      update_ncmds(ncmds - 1)
      update_sizeofcmds(sizeofcmds - lc.cmdsize)
      @raw_data.insert(header.class.bytesize + sizeofcmds - lc.cmdsize, Utils.nullpad(lc.cmdsize))
      populate_fields if options.fetch(:repopulate, true)
    end
def delete_command ( lc , options = { } ) @raw_data . slice! ( lc . view . offset , lc . cmdsize ) update_ncmds ( ncmds - 1 ) update_sizeofcmds ( sizeofcmds - lc . cmdsize ) @raw_data . insert ( header . class . bytesize + sizeofcmds - lc . cmdsize , Utils . nullpad ( lc . cmdsize ) ) populate_fields if options . fetch ( :repopulate , true ) end
Delete a load command from the Mach-O.
Delete a load command from the Mach - O .
# update Mach-O header fields to account for deleted load command # pad the space after the load commands to preserve offsets
None
void
lc
the load command being deleted
the load command being deleted
options
:repopulate (true) whether or not to repopulate the instance fields
: repopulate ( true ) whether or not to repopulate the instance fields
<not_specific>
None
note
This is public, but methods like {#delete_rpath} should be preferred. Setting `repopulate` to false **will leave the instance in an inconsistent state** unless {#populate_fields} is called **immediately afterwards.
This is public but methods like { #delete_rpath } should be preferred . Setting ` repopulate ` to false ** will leave the instance in an inconsistent state ** unless { #populate_fields } is called ** immediately afterwards .