Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix space after if() to match style guide

  • Loading branch information...
commit 23fd8d345654a972cfaf738eeea2b5b834322aee 1 parent 8ffde2e
Dirkjan Bussink dbussink authored
Showing with 122 additions and 122 deletions.
  1. +1 −1  vm/builtin/array.cpp
  2. +1 −1  vm/builtin/atomic.cpp
  3. +1 −1  vm/builtin/bignum.cpp
  4. +10 −10 vm/builtin/bytearray.cpp
  5. +3 −3 vm/builtin/encoding.cpp
  6. +12 −12 vm/builtin/io.cpp
  7. +5 −5 vm/builtin/nativefunction.cpp
  8. +1 −1  vm/builtin/object.cpp
  9. +1 −1  vm/builtin/pack18.cpp
  10. +1 −1  vm/builtin/pack19.cpp
  11. +4 −4 vm/builtin/regexp.cpp
  12. +5 −5 vm/builtin/string.cpp
  13. +1 −1  vm/builtin/time.cpp
  14. +1 −1  vm/builtin/variable_scope.cpp
  15. +5 −5 vm/capi/18/include/ruby.h
  16. +2 −2 vm/capi/19/include/ruby/regenc.h
  17. +5 −5 vm/capi/19/include/ruby/ruby.h
  18. +3 −3 vm/capi/array.cpp
  19. +1 −1  vm/capi/capi.cpp
  20. +5 −5 vm/capi/class.cpp
  21. +5 −5 vm/capi/encoding.cpp
  22. +2 −2 vm/capi/globals.cpp
  23. +1 −1  vm/capi/hash.cpp
  24. +5 −5 vm/capi/io.cpp
  25. +1 −1  vm/capi/marshal.cpp
  26. +2 −2 vm/capi/mri/compat.h
  27. +15 −15 vm/capi/numeric.cpp
  28. +14 −14 vm/capi/object.cpp
  29. +1 −1  vm/capi/regexp.cpp
  30. +1 −1  vm/capi/thread.cpp
  31. +2 −2 vm/config_parser.cpp
  32. +1 −1  vm/dtrace/dtrace.h
  33. +1 −1  vm/llvm/jit_context.cpp
  34. +1 −1  vm/shared_state.hpp
  35. +2 −2 vm/util/time64.c
2  vm/builtin/array.cpp
View
@@ -208,7 +208,7 @@ namespace rubinius {
idx += start_->to_native();
if(idx >= tuple_size) {
- if (oidx < tuple_size) {
+ if(oidx < tuple_size) {
// There is enough space in the tuple for this element
tuple_->lshift_inplace(state, start_);
} else {
2  vm/builtin/atomic.cpp
View
@@ -24,7 +24,7 @@ namespace rubinius {
Object* AtomicReference::compare_and_set(STATE, Object* old, Object* new_) {
Object** pp = &value_;
- if (atomic::compare_and_swap((void**)pp, old, new_)) {
+ if(atomic::compare_and_swap((void**)pp, old, new_)) {
if(mature_object_p()) this->write_barrier(state, new_);
return cTrue;
} else {
2  vm/builtin/bignum.cpp
View
@@ -1142,7 +1142,7 @@ namespace rubinius {
as<Bignum>(rest_i);
for(;;) {
- if (ary && n < sz) {
+ if(ary && n < sz) {
ary[n] = rest->to_ulong() & 0xffffffff;
}
20 vm/builtin/bytearray.cpp
View
@@ -264,31 +264,31 @@ namespace rubinius {
*uv = c;
- if (!(*uv & 0x80)) {
+ if(!(*uv & 0x80)) {
*lenp = 1;
return true;
}
- if (!(*uv & 0x40)) {
+ if(!(*uv & 0x40)) {
*lenp = 1;
return false;
}
if (!(*uv & 0x20)) { n = 2; *uv &= 0x1f; }
- else if (!(*uv & 0x10)) { n = 3; *uv &= 0x0f; }
- else if (!(*uv & 0x08)) { n = 4; *uv &= 0x07; }
- else if (!(*uv & 0x04)) { n = 5; *uv &= 0x03; }
- else if (!(*uv & 0x02)) { n = 6; *uv &= 0x01; }
+ else if(!(*uv & 0x10)) { n = 3; *uv &= 0x0f; }
+ else if(!(*uv & 0x08)) { n = 4; *uv &= 0x07; }
+ else if(!(*uv & 0x04)) { n = 5; *uv &= 0x03; }
+ else if(!(*uv & 0x02)) { n = 6; *uv &= 0x01; }
else {
*lenp = 1;
return false;
}
- if (n > *lenp) return false;
+ if(n > *lenp) return false;
*lenp = n--;
- if (n != 0) {
+ if(n != 0) {
while (n--) {
c = *p++ & 0xff;
- if ((c & 0xc0) != 0x80) {
+ if((c & 0xc0) != 0x80) {
*lenp -= n + 1;
return -1;
}
@@ -299,7 +299,7 @@ namespace rubinius {
}
}
n = *lenp - 1;
- if (*uv < utf8_limits[n]) return false;
+ if(*uv < utf8_limits[n]) return false;
return true;
}
6 vm/builtin/encoding.cpp
View
@@ -503,7 +503,7 @@ namespace rubinius {
int Encoding::mbclen(const uint8_t* p, const uint8_t* e, OnigEncodingType* enc) {
int n = ONIGENC_PRECISE_MBC_ENC_LEN(enc, (UChar*)p, (UChar*)e);
- if (ONIGENC_MBCLEN_CHARFOUND_P(n) && ONIGENC_MBCLEN_CHARFOUND_LEN(n) <= e-p) {
+ if(ONIGENC_MBCLEN_CHARFOUND_P(n) && ONIGENC_MBCLEN_CHARFOUND_LEN(n) <= e-p) {
return ONIGENC_MBCLEN_CHARFOUND_LEN(n);
} else {
int min = ONIGENC_MBC_MINLEN(enc);
@@ -514,12 +514,12 @@ namespace rubinius {
int Encoding::precise_mbclen(const uint8_t* p, const uint8_t* e, OnigEncodingType* enc) {
int n;
- if (e <= p) {
+ if(e <= p) {
return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(1);
}
n = ONIGENC_PRECISE_MBC_ENC_LEN(enc, (UChar*)p, (UChar*)e);
- if (e-p < n) {
+ if(e-p < n) {
return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(n-(int)(e-p));
}
24 vm/builtin/io.cpp
View
@@ -580,9 +580,9 @@ namespace rubinius {
}
}
- if (LANGUAGE_18_ENABLED(state)) {
+ if(LANGUAGE_18_ENABLED(state)) {
::close(fd);
- } else if (io->autoclose_ != cFalse) {
+ } else if(io->autoclose_ != cFalse) {
::close(fd);
}
}
@@ -765,17 +765,17 @@ namespace rubinius {
#ifdef HAVE_POSIX_FADVISE
int advice = 0;
- if (advice_name == state->symbol("normal")) {
+ if(advice_name == state->symbol("normal")) {
advice = POSIX_FADV_NORMAL;
- } else if (advice_name == state->symbol("sequential")) {
+ } else if(advice_name == state->symbol("sequential")) {
advice = POSIX_FADV_SEQUENTIAL;
- } else if (advice_name == state->symbol("random")) {
+ } else if(advice_name == state->symbol("random")) {
advice = POSIX_FADV_RANDOM;
- } else if (advice_name == state->symbol("willneed")) {
+ } else if(advice_name == state->symbol("willneed")) {
advice = POSIX_FADV_WILLNEED;
- } else if (advice_name == state->symbol("dontneed")) {
+ } else if(advice_name == state->symbol("dontneed")) {
advice = POSIX_FADV_DONTNEED;
- } else if (advice_name == state->symbol("noreuse")) {
+ } else if(advice_name == state->symbol("noreuse")) {
advice = POSIX_FADV_NOREUSE;
} else {
return Primitives::failure();
@@ -783,7 +783,7 @@ namespace rubinius {
int erno = posix_fadvise(to_fd(), offset->to_long_long(), len->to_long_long(), advice);
- if (erno) {
+ if(erno) {
Exception::errno_error(state, "posfix_fadvise(2) failed", erno);
}
@@ -849,7 +849,7 @@ namespace rubinius {
#ifndef RBX_WINDOWS
static const char* unixpath(struct sockaddr_un *sockaddr, socklen_t len) {
- if (sockaddr->sun_path < (char*)sockaddr + len) {
+ if(sockaddr->sun_path < (char*)sockaddr + len) {
return sockaddr->sun_path;
}
return "";
@@ -1032,7 +1032,7 @@ namespace rubinius {
const char *p = *pcur;
const char *s = *scur;
- if (period && *s == '.' && *UNESCAPE(p) != '.') /* leading period */
+ if(period && *s == '.' && *UNESCAPE(p) != '.') /* leading period */
RETURN(false);
while(1) {
@@ -1078,7 +1078,7 @@ namespace rubinius {
continue;
failed: /* try next '*' position */
- if (ptmp && stmp) {
+ if(ptmp && stmp) {
p = ptmp;
Inc(stmp); /* !ISEND(*stmp) */
s = stmp;
10 vm/builtin/nativefunction.cpp
View
@@ -781,7 +781,7 @@ namespace rubinius {
exc->locations(state, Location::from_call_stack(state, call_frame));
state->raise_exception(exc);
for(size_t i = 0; i < arg_count; i++) {
- if (heap_allocations[i]) {
+ if(heap_allocations[i]) {
XFREE(heap_allocations[i]);
}
}
@@ -941,7 +941,7 @@ namespace rubinius {
Object* o2 = obj->send(state, call_frame, state->symbol("to_ptr"));
if(!o2) {
for(size_t i = 0; i < arg_count; i++) {
- if (heap_allocations[i]) {
+ if(heap_allocations[i]) {
XFREE(heap_allocations[i]);
}
}
@@ -970,7 +970,7 @@ namespace rubinius {
Object* val = arg_info->enum_obj->send(state, call_frame, state->symbol("[]"), ary);
if(!val) {
for(size_t i = 0; i < arg_count; i++) {
- if (heap_allocations[i]) {
+ if(heap_allocations[i]) {
XFREE(heap_allocations[i]);
}
}
@@ -1014,7 +1014,7 @@ namespace rubinius {
char* data = ALLOC_N(char, size + 1);
- if (!data) {
+ if(!data) {
rubinius::bug("could not allocate memory for string");
}
@@ -1223,7 +1223,7 @@ namespace rubinius {
env->set_current_call_frame(saved_frame);
for(size_t i = 0; i < arg_count; i++) {
- if (heap_allocations[i]) {
+ if(heap_allocations[i]) {
XFREE(heap_allocations[i]);
}
}
2  vm/builtin/object.cpp
View
@@ -775,7 +775,7 @@ namespace rubinius {
Object* Object::taint(STATE) {
if(!is_tainted_p()) {
check_frozen(state);
- if (reference_p()) set_tainted();
+ if(reference_p()) set_tainted();
}
return this;
}
2  vm/builtin/pack18.cpp
View
@@ -375,7 +375,7 @@ namespace rubinius {
}
}
- if (count & 7) {
+ if(count & 7) {
byte <<= 7 - (count & 7);
str.push_back(byte & 0xff);
}
2  vm/builtin/pack19.cpp
View
@@ -379,7 +379,7 @@ namespace rubinius {
}
}
- if (count & 7) {
+ if(count & 7) {
byte <<= 7 - (count & 7);
str.push_back(byte & 0xff);
}
8 vm/builtin/regexp.cpp
View
@@ -91,10 +91,10 @@ namespace rubinius {
int get_kcode_from_enc(OnigEncoding enc) {
int r = 0;
- if (enc == ONIG_ENCODING_ASCII) r = KCODE_NONE;
- if (enc == ONIG_ENCODING_EUC_JP) r = KCODE_EUC;
- if (enc == ONIG_ENCODING_Shift_JIS) r = KCODE_SJIS;
- if (enc == ONIG_ENCODING_UTF_8) r = KCODE_UTF8;
+ if(enc == ONIG_ENCODING_ASCII) r = KCODE_NONE;
+ if(enc == ONIG_ENCODING_EUC_JP) r = KCODE_EUC;
+ if(enc == ONIG_ENCODING_Shift_JIS) r = KCODE_SJIS;
+ if(enc == ONIG_ENCODING_UTF_8) r = KCODE_UTF8;
return r;
}
10 vm/builtin/string.cpp
View
@@ -387,7 +387,7 @@ namespace rubinius {
return convert_meta(ctrl);
case 'C': /* \C-X, \C-\M-X */
- if (p == e || *p++ != '-') {
+ if(p == e || *p++ != '-') {
raise_error("control escape is too short");
}
// fall through
@@ -548,13 +548,13 @@ namespace rubinius {
break;
case 'u':
- if (ces.p == ces.e) {
+ if(ces.p == ces.e) {
ces.raise_error("escape sequence is too short");
}
ces.copy_bytes(-2);
- if (*ces.p == '{') { // \u{H HH HHH HHHH HHHHH HHHHHH ...}
+ if(*ces.p == '{') { // \u{H HH HHH HHHH HHHHH HHHHHH ...}
ces.p++;
int value = -1;
@@ -585,7 +585,7 @@ namespace rubinius {
case 'p': /* \p{Hiragana} */
case 'P':
/* TODO
- if (!*encp) {
+ if(!*encp) {
*has_property = 1;
}
*/
@@ -966,7 +966,7 @@ namespace rubinius {
native_int next = max >= 0 ? i + 1 : i;
if(max >= 0 && chr > max && !LANGUAGE_18_ENABLED(state)) {
std::ostringstream message;
- if (isprint(chr) && isprint(max)) {
+ if(isprint(chr) && isprint(max)) {
message << "invalid range \"";
message << (char)chr << "-" << (char)max;
message << "\" in string transliteration";
2  vm/builtin/time.cpp
View
@@ -290,7 +290,7 @@ namespace rubinius {
String* result = 0;
- if (chars == 0 && format->byte_size() > 0) {
+ if(chars == 0 && format->byte_size() > 0) {
malloc_str = (char*)malloc(buf_size);
chars = ::strftime_extended(malloc_str, buf_size,
2  vm/builtin/variable_scope.cpp
View
@@ -88,7 +88,7 @@ namespace rubinius {
if(num < 0) {
Exception::argument_error(state, "negative local index");
- } else if (num >= number_of_locals_) {
+ } else if(num >= number_of_locals_) {
Exception::argument_error(state, "index larger than number of locals");
}
10 vm/capi/18/include/ruby.h
View
@@ -1725,11 +1725,11 @@ VALUE rb_uint2big(unsigned long number);
/** New Enumerator. */
VALUE rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv);
-#define RETURN_ENUMERATOR(obj, argc, argv) do { \
- if (!rb_block_given_p()) \
- return rb_enumeratorize((obj), ID2SYM(rb_frame_this_func()),\
- (argc), (argv)); \
- } while (0)
+#define RETURN_ENUMERATOR(obj, argc, argv) do { \
+ if(!rb_block_given_p()) \
+ return rb_enumeratorize((obj), ID2SYM(rb_frame_this_func()),\
+ (argc), (argv)); \
+} while (0)
// include an extconf.h if one is provided
#ifdef RUBY_EXTCONF_H
4 vm/capi/19/include/ruby/regenc.h
View
@@ -68,8 +68,8 @@ typedef struct {
#define ONIG_IS_NULL(p) (((void*)(p)) == (void*)0)
#define ONIG_IS_NOT_NULL(p) (((void*)(p)) != (void*)0)
-#define ONIG_CHECK_NULL_RETURN(p) if (ONIG_IS_NULL(p)) return NULL
-#define ONIG_CHECK_NULL_RETURN_VAL(p,val) if (ONIG_IS_NULL(p)) return (val)
+#define ONIG_CHECK_NULL_RETURN(p) if(ONIG_IS_NULL(p)) return NULL
+#define ONIG_CHECK_NULL_RETURN_VAL(p,val) if(ONIG_IS_NULL(p)) return (val)
#define enclen(enc,p) ONIGENC_MBC_ENC_LEN(enc,p)
#define validate_prefix(enc,s,e,len) ONIGENC_VALIDATE_PREFIX(enc,s,e,len)
10 vm/capi/19/include/ruby/ruby.h
View
@@ -1888,11 +1888,11 @@ VALUE rb_uint2big(unsigned long number);
/** New Enumerator. */
VALUE rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv);
-#define RETURN_ENUMERATOR(obj, argc, argv) do { \
- if (!rb_block_given_p()) \
- return rb_enumeratorize((obj), ID2SYM(rb_frame_this_func()),\
- (argc), (argv)); \
- } while (0)
+#define RETURN_ENUMERATOR(obj, argc, argv) do { \
+ if(!rb_block_given_p()) \
+ return rb_enumeratorize((obj), ID2SYM(rb_frame_this_func()),\
+ (argc), (argv)); \
+} while (0)
// include an extconf.h if one is provided
#ifdef RUBY_EXTCONF_H
6 vm/capi/array.cpp
View
@@ -183,7 +183,7 @@ extern "C" {
Object* obj = env->get_object(object);
- if (kind_of<Array>(obj)) {
+ if(kind_of<Array>(obj)) {
return object;
}
@@ -287,7 +287,7 @@ extern "C" {
array->start(env->state(), Fixnum::from(0));
array->total(env->state(), Fixnum::from(length));
- if (objects) {
+ if(objects) {
for(std::size_t i = 0; i < length; ++i) {
// @todo determine if we need to check these objects for whether
// they are arrays and flush any caches
@@ -493,7 +493,7 @@ extern "C" {
Object* obj = env->get_object(object);
- if (kind_of<Array>(obj)) {
+ if(kind_of<Array>(obj)) {
return object;
}
2  vm/capi/capi.cpp
View
@@ -583,7 +583,7 @@ extern "C" {
}
void rb_need_block() {
- if (!rb_block_given_p()) {
+ if(!rb_block_given_p()) {
rb_raise(rb_eLocalJumpError, "no block given", 0);
}
}
10 vm/capi/class.cpp
View
@@ -105,13 +105,13 @@ extern "C" {
VALUE rb_cvar_defined(VALUE module_handle, ID name) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
- if (((Symbol *)name)->is_cvar_p(env->state())->true_p()) {
- return rb_funcall(module_handle, rb_intern("class_variable_defined?"),
- 1, name);
- } else {
+ if(((Symbol *)name)->is_cvar_p(env->state())->true_p()) {
+ return rb_funcall(module_handle, rb_intern("class_variable_defined?"),
+ 1, name);
+ } else {
return rb_funcall(module_handle, rb_intern("instance_variable_defined?"),
1, name);
- }
+ }
}
VALUE rb_cvar_get(VALUE module_handle, ID name) {
10 vm/capi/encoding.cpp
View
@@ -284,7 +284,7 @@ extern "C" {
int rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc) {
int n = ONIGENC_PRECISE_MBC_ENC_LEN(enc, (UChar*)p, (UChar*)e);
- if (ONIGENC_MBCLEN_CHARFOUND_P(n) && ONIGENC_MBCLEN_CHARFOUND_LEN(n) <= e-p)
+ if(ONIGENC_MBCLEN_CHARFOUND_P(n) && ONIGENC_MBCLEN_CHARFOUND_LEN(n) <= e-p)
return ONIGENC_MBCLEN_CHARFOUND_LEN(n);
else {
int min = rb_enc_mbminlen(enc);
@@ -309,21 +309,21 @@ extern "C" {
int rb_enc_codelen(int c, rb_encoding* enc)
{
int n = ONIGENC_CODE_TO_MBCLEN(enc, c);
- if (n == 0) {
+ if(n == 0) {
rb_raise(rb_eArgError, "invalid codepoint 0x%x in %s", c, rb_enc_name(enc));
}
return n;
}
char* rb_enc_nth(const char* p, const char* e, long nth, rb_encoding* enc) {
- if (rb_enc_mbmaxlen(enc) == 1) {
+ if(rb_enc_mbmaxlen(enc) == 1) {
p += nth;
- } else if (rb_enc_mbmaxlen(enc) == rb_enc_mbminlen(enc)) {
+ } else if(rb_enc_mbmaxlen(enc) == rb_enc_mbminlen(enc)) {
p += nth * rb_enc_mbmaxlen(enc);
} else {
p += Encoding::find_character_byte_index((uint8_t*)p, (uint8_t*)e, nth, enc);
}
- if (p > e) p = e;
+ if(p > e) p = e;
return (char*)p;
}
4 vm/capi/globals.cpp
View
@@ -81,8 +81,8 @@ extern "C" {
long len;
len = strlen(name);
- if ((len == 1 && name[0] == '~') ||
- (len == 2 && name[0] == '$' && name[1] == '~')) {
+ if((len == 1 && name[0] == '~') ||
+ (len == 2 && name[0] == '$' && name[1] == '~')) {
return env->get_handle(Regexp::last_match_result(env->state(),
Fixnum::from(0), Fixnum::from(0), env->current_call_frame()));
}
2  vm/capi/hash.cpp
View
@@ -69,7 +69,7 @@ extern "C" {
}
}
- if (rb_ary_size(to_delete) > 0) {
+ if(rb_ary_size(to_delete) > 0) {
for (long i = 0; i < rb_ary_size(to_delete); i++) {
capi_fast_call(self, rb_intern("delete"), 1, rb_ary_entry(to_delete, i));
}
10 vm/capi/io.cpp
View
@@ -35,11 +35,11 @@ namespace rubinius {
# define MODE_BINARY(a,b) (a)
#endif
int accmode = oflags & (O_RDONLY|O_WRONLY|O_RDWR);
- if (oflags & O_APPEND) {
- if (accmode == O_WRONLY) {
+ if(oflags & O_APPEND) {
+ if(accmode == O_WRONLY) {
return MODE_BINARY("a", "ab");
}
- if (accmode == O_RDWR) {
+ if(accmode == O_RDWR) {
return MODE_BINARY("a+", "ab+");
}
}
@@ -342,7 +342,7 @@ extern "C" {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
IO* io = c_as<IO>(env->get_object(io_handle));
int io_mode = io->mode()->to_native() & O_ACCMODE;
- if (!(O_RDONLY == io_mode || O_RDWR == io_mode)) {
+ if(!(O_RDONLY == io_mode || O_RDWR == io_mode)) {
rb_raise(rb_eIOError, "not opened for reading");
}
}
@@ -352,7 +352,7 @@ extern "C" {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
IO* io = c_as<IO>(env->get_object(io_handle));
int io_mode = io->mode()->to_native() & O_ACCMODE;
- if (!(O_WRONLY == io_mode || O_RDWR == io_mode)) {
+ if(!(O_WRONLY == io_mode || O_RDWR == io_mode)) {
rb_raise(rb_eIOError, "not opened for writing");
}
}
2  vm/capi/marshal.cpp
View
@@ -12,7 +12,7 @@ extern "C" {
argv[0] = obj;
- if (!NIL_P(io)) {
+ if(!NIL_P(io)) {
argv[1] = io;
argc = 2;
}
4 vm/capi/mri/compat.h
View
@@ -110,7 +110,7 @@ rb_hash_lookup(hash, key)
{
VALUE val;
- if (!st_lookup(RHASH(hash)->tbl, key, &val)) {
+ if(!st_lookup(RHASH(hash)->tbl, key, &val)) {
return Qnil; /* without Hash#default */
}
return val;
@@ -141,7 +141,7 @@ static VALUE
rb_hash_clear(hash)
VALUE hash;
{
- if (RHASH(hash)->tbl->num_entries > 0) {
+ if(RHASH(hash)->tbl->num_entries > 0) {
rb_hash_foreach(hash, __rb_hash_clear_clear_i, 0);
}
30 vm/capi/numeric.cpp
View
@@ -193,23 +193,23 @@ extern "C" {
int w;
#define OutOfRange() (((w = end - p) > 20) ? (w = 20, ellipsis = "...") : (ellipsis = ""))
- if (!p) return 0.0;
+ if(!p) return 0.0;
q = p;
while (ISSPACE(*p)) p++;
d = ::ruby_strtod(p, &end);
- if (errno == ERANGE) {
+ if(errno == ERANGE) {
OutOfRange();
rb_warning("Float %.*s%s out of range", w, p, ellipsis);
errno = 0;
}
- if (p == end) {
- if (badcheck) {
+ if(p == end) {
+ if(badcheck) {
bad:
rb_invalid_str(q, "Float()");
}
return d;
}
- if (*end) {
+ if(*end) {
char buf[DBL_DIG * 4 + 10];
char *n = buf;
char *e = buf + sizeof(buf) - 1;
@@ -217,35 +217,35 @@ extern "C" {
while (p < end && n < e) prev = *n++ = *p++;
while (*p) {
- if (*p == '_') {
+ if(*p == '_') {
/* remove underscores between digits */
- if (badcheck) {
- if (n == buf || !ISDIGIT(prev)) goto bad;
+ if(badcheck) {
+ if(n == buf || !ISDIGIT(prev)) goto bad;
++p;
- if (!ISDIGIT(*p)) goto bad;
+ if(!ISDIGIT(*p)) goto bad;
} else {
while (*++p == '_');
continue;
}
}
prev = *p++;
- if (n < e) *n++ = prev;
+ if(n < e) *n++ = prev;
}
*n = '\0';
p = buf;
d = ::ruby_strtod(p, &end);
- if (errno == ERANGE) {
+ if(errno == ERANGE) {
OutOfRange();
rb_warning("Float %.*s%s out of range", w, p, ellipsis);
errno = 0;
}
- if (badcheck) {
- if (!end || p == end) goto bad;
+ if(badcheck) {
+ if(!end || p == end) goto bad;
while (*end && ISSPACE(*end)) end++;
- if (*end) goto bad;
+ if(*end) goto bad;
}
}
- if (errno == ERANGE) {
+ if(errno == ERANGE) {
errno = 0;
OutOfRange();
rb_raise(rb_eArgError, "Float %.*s%s out of range", w, q, ellipsis);
28 vm/capi/object.cpp
View
@@ -81,22 +81,22 @@ extern "C" {
void rb_check_type(VALUE x, int t) {
struct types *type = builtin_types;
- if (x == Qundef) {
+ if(x == Qundef) {
rb_bug("undef leaked to the Ruby space");
}
- if (TYPE(x) != t) {
+ if(TYPE(x) != t) {
while (type->type >= 0) {
- if (type->type == t) {
+ if(type->type == t) {
const char *etype;
- if (NIL_P(x)) {
+ if(NIL_P(x)) {
etype = "nil";
- } else if (FIXNUM_P(x)) {
+ } else if(FIXNUM_P(x)) {
etype = "Fixnum";
- } else if (SYMBOL_P(x)) {
+ } else if(SYMBOL_P(x)) {
etype = "Symbol";
- } else if (rb_special_const_p(x)) {
+ } else if(rb_special_const_p(x)) {
etype = RSTRING_PTR(rb_obj_as_string(x));
} else {
etype = rb_obj_classname(x);
@@ -173,12 +173,12 @@ extern "C" {
}
int rb_type(VALUE obj) {
- if (FIXNUM_P(obj)) return T_FIXNUM;
- if (obj == Qnil) return T_NIL;
- if (obj == Qfalse) return T_FALSE;
- if (obj == Qtrue) return T_TRUE;
- if (obj == Qundef) return T_UNDEF;
- if (SYMBOL_P(obj)) return T_SYMBOL;
+ if(FIXNUM_P(obj)) return T_FIXNUM;
+ if(obj == Qnil) return T_NIL;
+ if(obj == Qfalse) return T_FALSE;
+ if(obj == Qtrue) return T_TRUE;
+ if(obj == Qundef) return T_UNDEF;
+ if(SYMBOL_P(obj)) return T_SYMBOL;
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
Object* object = env->get_object(obj);
@@ -238,7 +238,7 @@ extern "C" {
Object* object = env->get_object(obj_handle);
- if (kind_of<String>(object)) {
+ if(kind_of<String>(object)) {
return obj_handle;
}
2  vm/capi/regexp.cpp
View
@@ -23,7 +23,7 @@ extern "C" {
}
VALUE rb_reg_nth_match(long nth, VALUE match_data) {
- if (NIL_P(match_data)) {
+ if(NIL_P(match_data)) {
return Qnil;
}
return rb_funcall(match_data, rb_intern("[]"), 1, Fixnum::from(nth));
2  vm/capi/thread.cpp
View
@@ -130,7 +130,7 @@ extern "C" {
State* state = env->state();
VALUE ret = Qnil;
- if (ubf == RUBY_UBF_IO || ubf == RUBY_UBF_PROCESS) {
+ if(ubf == RUBY_UBF_IO || ubf == RUBY_UBF_PROCESS) {
state->vm()->interrupt_with_signal();
} else {
state->vm()->wait_on_custom_function(ubf, ubf_data);
4 vm/config_parser.cpp
View
@@ -135,7 +135,7 @@ namespace rubinius {
for(ConfigParser::ConfigVector::iterator i = variables.begin();
i != variables.end();
++i) {
- if (i->first == name) return i->second;
+ if(i->first == name) return i->second;
}
return NULL;
@@ -145,7 +145,7 @@ namespace rubinius {
for(ConfigParser::ConfigVector::iterator i = variables.begin();
i != variables.end();
++i) {
- if (i->first == name) {
+ if(i->first == name) {
i->second->value = val;
return;
}
2  vm/dtrace/dtrace.h
View
@@ -6,7 +6,7 @@
#define RUBINIUS_METHOD_HOOK(probe, state, mod, method, previous) \
{ \
- if (RUBINIUS_METHOD_##probe##_ENABLED()) { \
+ if(RUBINIUS_METHOD_##probe##_ENABLED()) { \
const char* module_name = mod->debug_str(state).c_str(); \
const char* code_name = method->debug_str(state).c_str(); \
const char* file_name = "<unknown>"; \
2  vm/llvm/jit_context.cpp
View
@@ -27,7 +27,7 @@ namespace rubinius {
void IRBuilderInserterWithDebug::InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
llvm::BasicBlock *BB, llvm::BasicBlock::iterator InsertPt) const {
I->setDebugLoc(builder_->b().getCurrentDebugLocation());
- if (BB) BB->getInstList().insert(InsertPt, I);
+ if(BB) BB->getInstList().insert(InsertPt, I);
I->setName(Name);
}
2  vm/shared_state.hpp
View
@@ -268,7 +268,7 @@ namespace rubinius {
bool check_gc_p() {
bool c = check_gc_;
- if (unlikely(c)) {
+ if(unlikely(c)) {
check_global_interrupts_ = false;
check_gc_ = false;
}
4 vm/util/time64.c
View
@@ -393,11 +393,11 @@ struct tm64* gmtime64_r(const time64_t* time64, struct tm64* tm64) {
* Week day is easy since we know the day that the epoch occured
*/
tm64->tm_wday = (int)((days + 4) % 7);
- if (tm64->tm_wday < 0) {
+ if(tm64->tm_wday < 0) {
tm64->tm_wday += 7;
}
- if (days >= 0) {
+ if(days >= 0) {
/* Gregorian cycles */
int64_t cycles = days / DAYS_IN_GREGORIAN_CYCLE;
if(cycles) {
Please sign in to comment.
Something went wrong with that request. Please try again.