aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-22 10:55:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-22 10:55:22 +0000
commitcf35eb556d2b7c595b6f2492609f224426d455de (patch)
treee88ef2d5418fd5a62883163d50961d2dd84626ec
parentb2da46094d7dc6a6a257693e3a85fb7949e68573 (diff)
downloadruby-cf35eb556d2b7c595b6f2492609f224426d455de.tar.gz
Fix Issues reported by PVS-Studio static analyzer
* vm.c (vm_set_main_stack): remove unnecessary check. toplevel binding must be initialized. [Bug #12611] (N1) * win32/win32.c (w32_symlink): fix return type. [Bug #12611] (N3) * string.c (rb_str_split_m): simplify the condition. [Bug #12611](N4) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--string.c2
-rw-r--r--vm.c2
-rw-r--r--win32/win32.c2
4 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 792c5865df..29da176336 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Fri Jul 22 19:55:20 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (vm_set_main_stack): remove unnecessary check. toplevel
+ binding must be initialized. [Bug #12611] (N1)
+
+ * win32/win32.c (w32_symlink): fix return type. [Bug #12611] (N3)
+
+ * string.c (rb_str_split_m): simplify the condition.
+ [Bug #12611](N4)
+
Fri Jul 22 17:13:37 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* string.c (String#dump): Change escaping of non-ASCII characters in
diff --git a/string.c b/string.c
index 5b5f69a60a..4a24e5d67c 100644
--- a/string.c
+++ b/string.c
@@ -7235,7 +7235,7 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
beg = start;
}
else {
- if (ptr+start == ptr+len)
+ if (start == len)
start++;
else
start += rb_enc_fast_mbclen(ptr+start,ptr+len,enc);
diff --git a/vm.c b/vm.c
index c3e7bb3258..4f4c646b94 100644
--- a/vm.c
+++ b/vm.c
@@ -379,7 +379,7 @@ vm_set_main_stack(rb_thread_t *th, const rb_iseq_t *iseq)
vm_set_eval_stack(th, iseq, 0, &env->block);
/* save binding */
- if (bind && iseq->body->local_size > 0) {
+ if (iseq->body->local_size > 0) {
bind->env = vm_make_env_object(th, th->cfp);
}
}
diff --git a/win32/win32.c b/win32/win32.c
index f3ddb9cc66..0b8ffe7687 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4947,7 +4947,7 @@ w32_symlink(UINT cp, const char *src, const char *link)
DWORD flag = 0;
BOOLEAN ret;
- typedef DWORD (WINAPI *create_symbolic_link_func)(WCHAR*, WCHAR*, DWORD);
+ typedef BOOLEAN (WINAPI *create_symbolic_link_func)(WCHAR*, WCHAR*, DWORD);
static create_symbolic_link_func create_symbolic_link =
(create_symbolic_link_func)-1;