1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* random.c (rand_init): remove useless assignment.

* re.c (update_char_offset): remove unused variable.

* re.c (read_escaped_byte): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-10-04 01:23:58 +00:00
parent 3a633b812e
commit b259e449d1
3 changed files with 11 additions and 6 deletions

View file

@ -1,3 +1,11 @@
Mon Oct 4 09:47:39 2010 NARUSE, Yui <naruse@ruby-lang.org>
* random.c (rand_init): remove useless assignment.
* re.c (update_char_offset): remove unused variable.
* re.c (read_escaped_byte): ditto.
Mon Oct 4 09:30:42 2010 NARUSE, Yui <naruse@ruby-lang.org>
* ext/openssl/lib/openssl/bn.rb (Integer#to_bn): OpenSSL::BN.new

View file

@ -415,7 +415,7 @@ rand_init(struct MT *mt, VALUE vseed)
}
else {
if (blen > MT_MAX_STATE * SIZEOF_INT32 / SIZEOF_BDIGITS)
blen = (len = MT_MAX_STATE) * SIZEOF_INT32 / SIZEOF_BDIGITS;
blen = MT_MAX_STATE * SIZEOF_INT32 / SIZEOF_BDIGITS;
len = roomof((int)blen * SIZEOF_BDIGITS, SIZEOF_INT32);
}
/* allocate ints for init_by_array */
@ -1066,7 +1066,7 @@ random_rand(int argc, VALUE *argv, VALUE obj)
v = Qnil;
}
else if (TYPE(vmax) != T_FLOAT && (v = rb_check_to_integer(vmax, "to_int"), !NIL_P(v))) {
v = rand_int(&rnd->mt, vmax = v, 1);
v = rand_int(&rnd->mt, v, 1);
}
else if (v = rb_check_to_float(vmax), !NIL_P(v)) {
double max = float_value(v);

5
re.c
View file

@ -859,7 +859,7 @@ update_char_offset(VALUE match)
struct re_registers *regs;
int i, num_regs, num_pos;
long c;
char *s, *p, *q, *e;
char *s, *p, *q;
rb_encoding *enc;
pair_t *pairs;
@ -895,7 +895,6 @@ update_char_offset(VALUE match)
qsort(pairs, num_pos, sizeof(pair_t), pair_byte_cmp);
s = p = RSTRING_PTR(RMATCH(match)->str);
e = s + RSTRING_LEN(RMATCH(match)->str);
c = 0;
for (i = 0; i < num_pos; i++) {
q = s + pairs[i].byte_pos;
@ -1899,9 +1898,7 @@ read_escaped_byte(const char **pp, const char *end, onig_errmsg_buffer err)
int code;
int meta_prefix = 0, ctrl_prefix = 0;
size_t len;
int retbyte;
retbyte = -1;
if (p == end || *p++ != '\\') {
errcpy(err, "too short escaped multibyte character");
return -1;