diff options
author | Araq <rumpf_a@web.de> | 2017-12-27 10:34:31 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-12-27 10:34:31 +0100 |
commit | b3732e23716166dfa7c77e8dc1ee9b4571853aed (patch) | |
tree | 39ad24fd1b3a69ce74d4e4a68c242d6d18f04c64 /lib/system/sysstr.nim | |
parent | 5c08092b88c0b6399c52804fd6f2c1fc92c58a86 (diff) | |
parent | 53cf0b2c24e5adc4fa99e49ddf1834991d663846 (diff) | |
download | Nim-b3732e23716166dfa7c77e8dc1ee9b4571853aed.tar.gz |
Merge branch 'devel' of github.com:nim-lang/Nim into devel
Diffstat (limited to 'lib/system/sysstr.nim')
-rw-r--r-- | lib/system/sysstr.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim index 56b8ade97..4c5f3d9a1 100644 --- a/lib/system/sysstr.nim +++ b/lib/system/sysstr.nim @@ -24,10 +24,10 @@ proc cmpStrings(a, b: NimString): int {.inline, compilerProc.} = if a == b: return 0 if a == nil: return -1 if b == nil: return 1 - when defined(nimNoArrayToCstringConversion): - return c_strcmp(addr a.data, addr b.data) - else: - return c_strcmp(a.data, b.data) + let minlen = min(a.len, b.len) + result = c_memcmp(addr a.data, addr b.data, minlen.csize) + if result == 0: + result = a.len - b.len proc eqStrings(a, b: NimString): bool {.inline, compilerProc.} = if a == b: return true |