Permalink
Browse files

Fix space after if() to match style guide

  • Loading branch information...
1 parent 8ffde2e commit 23fd8d345654a972cfaf738eeea2b5b834322aee @dbussink dbussink committed Mar 26, 2013
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 {
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 {
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;
}
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;
}
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));
}
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,25 +765,25 @@ 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();
}
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;
@@ -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]);
}
}
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;
}
View
@@ -375,7 +375,7 @@ namespace rubinius {
}
}
- if (count & 7) {
+ if(count & 7) {
byte <<= 7 - (count & 7);
str.push_back(byte & 0xff);
}
View
@@ -379,7 +379,7 @@ namespace rubinius {
}
}
- if (count & 7) {
+ if(count & 7) {
byte <<= 7 - (count & 7);
str.push_back(byte & 0xff);
}
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;
}
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";
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,
@@ -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");
}
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
@@ -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)
@@ -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
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;
}
Oops, something went wrong.

0 comments on commit 23fd8d3

Please sign in to comment.