ruby-changes:36943
From: nobu <ko1@a...>
Date: Fri, 26 Dec 2014 14:51:42 +0900 (JST)
Subject: [ruby-changes:36943] nobu:r49024 (trunk): never-NULL pointer check
nobu 2014-12-26 14:51:36 +0900 (Fri, 26 Dec 2014) New Revision: 49024 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49024 Log: never-NULL pointer check * dir.c (ruby_glob0): no need to check never-NULL pointer. reported by Denis Denisov <denji0k AT gmail.com>. * win32/file.c (rb_file_expand_path_internal): ditto. Modified files: trunk/ChangeLog trunk/dir.c trunk/win32/file.c Index: ChangeLog =================================================================== --- ChangeLog (revision 49023) +++ ChangeLog (revision 49024) @@ -1,4 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 -Fri Dec 26 14:48:10 2014 Nobuyoshi Nakada <nobu@r...> +Fri Dec 26 14:51:34 2014 Nobuyoshi Nakada <nobu@r...> + + * dir.c (ruby_glob0): no need to check never-NULL pointer. + reported by Denis Denisov <denji0k AT gmail.com>. + + * win32/file.c (rb_file_expand_path_internal): ditto. * win32/file.c (code_page_i): handle realloc failure. reported by Denis Denisov <denji0k AT gmail.com>. Index: dir.c =================================================================== --- dir.c (revision 49023) +++ dir.c (revision 49024) @@ -1690,7 +1690,7 @@ ruby_glob0(const char *path, int flags, https://github.com/ruby/ruby/blob/trunk/dir.c#L1690 root = rb_enc_path_skip_prefix(root, root + strlen(root), enc); #endif - if (root && *root == '/') root++; + if (*root == '/') root++; n = root - start; buf = GLOB_ALLOC_N(char, n + 1); Index: win32/file.c =================================================================== --- win32/file.c (revision 49023) +++ win32/file.c (revision 49024) @@ -626,7 +626,7 @@ rb_file_expand_path_internal(VALUE fname https://github.com/ruby/ruby/blob/trunk/win32/file.c#L626 if (whome) xfree(whome); - if (wfullpath && wfullpath != wfullpath_buffer) + if (wfullpath != wfullpath_buffer) xfree(wfullpath); if (fullpath) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/