mirror of
https://github.com/danog/gllvm.git
synced 2024-11-30 08:39:03 +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)
|
machoFile, err := macho.Open(inputFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
LogError("Mach-O file %s could not be read.", inputFile)
|
LogError("Mach-O file %s could not be read.", inputFile)
|
||||||
success = false
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
section := machoFile.Section(DarwinSectionName)
|
section := machoFile.Section(DarwinSectionName)
|
||||||
if section == nil {
|
if section == nil {
|
||||||
LogError("The %s section of %s is missing!\n", DarwinSectionName, inputFile)
|
LogError("The %s section of %s is missing!\n", DarwinSectionName, inputFile)
|
||||||
success = false
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sectionContents, errContents := section.Data()
|
sectionContents, errContents := section.Data()
|
||||||
if errContents != nil {
|
if errContents != nil {
|
||||||
LogError("Error reading the %s section of Mach-O file %s.", DarwinSectionName, inputFile)
|
LogError("Error reading the %s section of Mach-O file %s.", DarwinSectionName, inputFile)
|
||||||
success = false
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
contents = strings.Split(strings.TrimSuffix(string(sectionContents), "\n"), "\n")
|
contents = strings.Split(strings.TrimSuffix(string(sectionContents), "\n"), "\n")
|
||||||
|
success = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,22 +707,20 @@ func extractSectionUnix(inputFile string) (contents []string, success bool) {
|
|||||||
elfFile, err := elf.Open(inputFile)
|
elfFile, err := elf.Open(inputFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
LogError("ELF file %s could not be read.", inputFile)
|
LogError("ELF file %s could not be read.", inputFile)
|
||||||
success = false
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
section := elfFile.Section(ELFSectionName)
|
section := elfFile.Section(ELFSectionName)
|
||||||
if section == nil {
|
if section == nil {
|
||||||
LogError("Error reading the %s section of ELF file %s.", ELFSectionName, inputFile)
|
LogError("Error reading the %s section of ELF file %s.", ELFSectionName, inputFile)
|
||||||
success = false
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sectionContents, errContents := section.Data()
|
sectionContents, errContents := section.Data()
|
||||||
if errContents != nil {
|
if errContents != nil {
|
||||||
LogError("Error reading the %s section of ELF file %s.", ELFSectionName, inputFile)
|
LogError("Error reading the %s section of ELF file %s.", ELFSectionName, inputFile)
|
||||||
success = false
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
contents = strings.Split(strings.TrimSuffix(string(sectionContents), "\n"), "\n")
|
contents = strings.Split(strings.TrimSuffix(string(sectionContents), "\n"), "\n")
|
||||||
|
success = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user