summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorAndreas Rumpf <andreas@andreas-laptop>2010-07-21 09:44:47 +0200
committerAndreas Rumpf <andreas@andreas-laptop>2010-07-21 09:44:47 +0200
commitd10973adb00840631e5314ec902d502f15934801 (patch)
treea207854b0cf984815beb26bf2d71933ce566f6d7 /lib/pure
parentc441cdb64ca5394f74faadf76563bcfafeda18f4 (diff)
downloadNim-d10973adb00840631e5314ec902d502f15934801.tar.gz
c2nim tool added
Diffstat (limited to 'lib/pure')
-rwxr-xr-xlib/pure/osproc.nim2
-rwxr-xr-xlib/pure/strutils.nim7
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim
index c9bd729d9..764a1f896 100755
--- a/lib/pure/osproc.nim
+++ b/lib/pure/osproc.nim
@@ -117,7 +117,7 @@ when defined(macosx) or defined(bsd):
 
 proc countProcessors*(): int =
   ## returns the numer of the processors/cores the machine has.
-  ## Returns 0 if it cannot be determined.
+  ## Returns 0 if it cannot be detected.
   when defined(windows):
     var x = getenv("NUMBER_OF_PROCESSORS")
     if x.len > 0: result = parseInt(x)
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim
index 961c875ac..38f6ffa9a 100755
--- a/lib/pure/strutils.nim
+++ b/lib/pure/strutils.nim
@@ -391,10 +391,13 @@ proc endsWith(s, suffix: string): bool =
   var

     i = 0

     j = len(s) - len(suffix)

-  while true:

-    if suffix[i] == '\0': return true

+  while i+j <% s.len:

     if s[i+j] != suffix[i]: return false

     inc(i)

+  if suffix[i] == '\0': return true

+
+# 012345
+#    345
 

 when false:

   proc abbrev(s: string, possibilities: openarray[string]): int =