Skip to content

Don't use nil tests for strings. #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions sim/opbsim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ proc newRomInfo(memFile: string, logFile: string): ref RomInfo =
new result
result.data = readMemFile(memFile)[]

if logFile != nil and logFile != "":
if logFile != "":
result.symbolTable = extractSymbols(logFile)
else:
result.symbolTable = initTable[int32, string]()
Expand Down Expand Up @@ -1046,7 +1046,7 @@ proc parseCommandLine() : CommandOptions =

if cmdOpts.version: echo "OPBSIM version ", buildVersion; quit(0)

if cmdOpts.memFile == "" or cmdOpts.memFile == nil: echo usageString; quit(1)
if cmdOpts.memFile == "": echo usageString; quit(1)
if cmdOpts.usePB3 and cmdOpts.usePB6:
echo "Invalid options: Select only one PicoBlaze architecture"
quit(1)
Expand Down Expand Up @@ -1077,7 +1077,7 @@ proc main() =

var jsonInput : array[0..255, uint8]

if cmdOpts.jsonInput != "" and cmdOpts.jsonInput != nil:
if cmdOpts.jsonInput != "":
# Initialize input data
let jobj = parseJson(cmdOpts.jsonInput)
assert jobj.kind == JObject
Expand All @@ -1100,7 +1100,7 @@ proc main() =


# Look for log file if one wasn't provided in arguments
if cmdOpts.logFile == "" or cmdOpts.logFile == nil:
if cmdOpts.logFile == "":
let elems = splitFile(cmdOpts.memFile)
let logFile = elems.dir / (elems.name & ".log")
if fileExists(logFile):
Expand All @@ -1113,7 +1113,7 @@ proc main() =
if not cmdOpts.quiet:
echo "Read $# words\n" % [$len(romData.data)]

if cmdOpts.logFile != nil and cmdOpts.logFile != "":
if cmdOpts.logFile != "":
echo "Found $# symbols in $#\n" % [$len(romData.symbolTable), cmdOpts.logFile]


Expand Down