From 763930302205c61e4909dc429d61e33624d61d6b Mon Sep 17 00:00:00 2001 From: Sunil Nimmagadda Date: Thu, 5 Nov 2026 23:25:40 +0530 Subject: Move all the validations to correct place. --- elf/header.lua | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'elf/header.lua') diff --git a/elf/header.lua b/elf/header.lua index de939d9..179e3bd 100644 --- a/elf/header.lua +++ b/elf/header.lua @@ -50,20 +50,6 @@ local M = {} ---@param hdropts HeaderOptions ---@return Header function M.normalize(hdropts) - -- TODO drop these error() and return, let callers report. - if not hdropts.class then error("class is required in header", 3) end - if not hdropts.data then error("data is required in header", 3) end - if not hdropts.type then error("type is required in header", 3) end - if not hdropts.machine then error("machine is required in header", 3) end - - -- Can't pack without these values being valid. - if hdropts.class ~= ec.Class.bit32 and hdropts.class ~= ec.Class.bit64 then - error("class must be Class.bit32 or Class.bit64 in header", 3) - end - if hdropts.data ~= ec.Endian.little and hdropts.data ~= ec.Endian.big then - error("data must be Endian.little or Endian.big in header", 3) - end - local phoff, ehsize, phentsize, shentsize if hdropts.class == ec.Class.bit32 then phoff = hdropts.phoff or 0x34 -- cgit v1.3