summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-03-03 13:25:25 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-03-03 13:25:25 +0900
commit933f8013e0d2ef1b228ca8607e05c85b15b09d58 (patch)
treea0d0b13c207867036d4a9474c23494b5ef1b9595
parent9a92b40aaf0fc7b94623f5fca3692167b4048643 (diff)
parent55a43c78ffb6a5e42177e98d72f91b3c53964cdc (diff)
downloadmruby-933f8013e0d2ef1b228ca8607e05c85b15b09d58.tar.gz
mruby-933f8013e0d2ef1b228ca8607e05c85b15b09d58.zip
Merge branch 'master' of github.com:mruby/mruby
-rw-r--r--include/mruby/compile.h2
-rw-r--r--include/mruby/data.h2
-rw-r--r--mrbgems/mruby-random/src/random.c6
-rw-r--r--tasks/mruby_build_gem.rake6
-rw-r--r--test/t/string.rb4
5 files changed, 14 insertions, 6 deletions
diff --git a/include/mruby/compile.h b/include/mruby/compile.h
index c22f8079a..4f9c49191 100644
--- a/include/mruby/compile.h
+++ b/include/mruby/compile.h
@@ -5,7 +5,7 @@
*/
#ifndef MRUBY_COMPILE_H
-#define MRUBY_COMPILE_H 1
+#define MRUBY_COMPILE_H
#if defined(__cplusplus)
extern "C" {
diff --git a/include/mruby/data.h b/include/mruby/data.h
index f0420a0c6..8b1b5edb7 100644
--- a/include/mruby/data.h
+++ b/include/mruby/data.h
@@ -5,7 +5,7 @@
*/
#ifndef MRUBY_DATA_H
-#define MRUBY_DATA_H 1
+#define MRUBY_DATA_H
#if defined(__cplusplus)
extern "C" {
diff --git a/mrbgems/mruby-random/src/random.c b/mrbgems/mruby-random/src/random.c
index a708923d3..9fb5bbfd8 100644
--- a/mrbgems/mruby-random/src/random.c
+++ b/mrbgems/mruby-random/src/random.c
@@ -115,15 +115,15 @@ mrb_random_init(mrb_state *mrb, mrb_value self)
mrb_value seed;
mt_state *t;
- DATA_TYPE(self) = &mt_state_type;
- DATA_PTR(self) = NULL;
-
/* avoid memory leaks */
t = (mt_state*)DATA_PTR(self);
if (t) {
mrb_free(mrb, t);
}
+ DATA_TYPE(self) = &mt_state_type;
+ DATA_PTR(self) = NULL;
+
t = (mt_state *)mrb_malloc(mrb, sizeof(mt_state));
t->mti = N + 1;
diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake
index c9bf794e3..5e4566f8d 100644
--- a/tasks/mruby_build_gem.rake
+++ b/tasks/mruby_build_gem.rake
@@ -43,7 +43,11 @@ module MRuby
if params[:github]
params[:git] = "https://github.com/#{params[:github]}.git"
elsif params[:bitbucket]
- params[:git] = "https://bitbucket.org/#{params[:bitbucket]}.git"
+ if params[:method] == "ssh"
+ params[:git] = "[email protected]:#{params[:bitbucket]}.git"
+ else
+ params[:git] = "https://bitbucket.org/#{params[:bitbucket]}.git"
+ end
end
if params[:core]
diff --git a/test/t/string.rb b/test/t/string.rb
index 3219f98c3..2ebaad1b7 100644
--- a/test/t/string.rb
+++ b/test/t/string.rb
@@ -36,6 +36,10 @@ end
assert('String#*', '15.2.10.5.5') do
assert_equal 'aaaaa', 'a' * 5
+ assert_equal '', 'a' * 0
+ assert_raise(ArgumentError) do
+ 'a' * -1
+ end
end
assert('String#[]', '15.2.10.5.6') do