mirror of
https://github.com/danog/gllvm.git
synced 2024-11-30 06:39:06 +01:00
extractor: Fix success assignment
Booleans are default-initialized to false, so we only need to assign to true in the success case.
This commit is contained in:
parent
d235e663df
commit
3389f1fde6
@ -686,22 +686,20 @@ func extractSectionDarwin(inputFile string) (contents []string, success bool) {
|
||||
machoFile, err := macho.Open(inputFile)
|
||||
if err != nil {
|
||||
LogError("Mach-O file %s could not be read.", inputFile)
|
||||
success = false
|
||||
return
|
||||
}
|
||||
section := machoFile.Section(DarwinSectionName)
|
||||
if section == nil {
|
||||
LogError("The %s section of %s is missing!\n", DarwinSectionName, inputFile)
|
||||
success = false
|
||||
return
|
||||
}
|
||||
sectionContents, errContents := section.Data()
|
||||
if errContents != nil {
|
||||
LogError("Error reading the %s section of Mach-O file %s.", DarwinSectionName, inputFile)
|
||||
success = false
|
||||
return
|
||||
}
|
||||
contents = strings.Split(strings.TrimSuffix(string(sectionContents), "\n"), "\n")
|
||||
success = true
|
||||
return
|
||||
}
|
||||
|
||||
@ -709,22 +707,20 @@ func extractSectionUnix(inputFile string) (contents []string, success bool) {
|
||||
elfFile, err := elf.Open(inputFile)
|
||||
if err != nil {
|
||||
LogError("ELF file %s could not be read.", inputFile)
|
||||
success = false
|
||||
return
|
||||
}
|
||||
section := elfFile.Section(ELFSectionName)
|
||||
if section == nil {
|
||||
LogError("Error reading the %s section of ELF file %s.", ELFSectionName, inputFile)
|
||||
success = false
|
||||
return
|
||||
}
|
||||
sectionContents, errContents := section.Data()
|
||||
if errContents != nil {
|
||||
LogError("Error reading the %s section of ELF file %s.", ELFSectionName, inputFile)
|
||||
success = false
|
||||
return
|
||||
}
|
||||
contents = strings.Split(strings.TrimSuffix(string(sectionContents), "\n"), "\n")
|
||||
success = true
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user