summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-04-20 23:11:43 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2013-04-20 23:11:43 +0900
commitc79172dfd5a7600300ac215cce1ccc766ec9aa98 (patch)
treeed9cb374cd73a26b51090fc1b783162f9b912318 /src
parent2acf72455406540f77b7c4809d8bf2bd2878a907 (diff)
downloadmruby-c79172dfd5a7600300ac215cce1ccc766ec9aa98.tar.gz
mruby-c79172dfd5a7600300ac215cce1ccc766ec9aa98.zip
put spaces after if/while
Diffstat (limited to 'src')
-rw-r--r--src/array.c20
-rw-r--r--src/class.c2
-rw-r--r--src/dump.c16
-rw-r--r--src/load.c34
-rw-r--r--src/string.c2
-rw-r--r--src/vm.c4
6 files changed, 39 insertions, 39 deletions
diff --git a/src/array.c b/src/array.c
index b1f05b450..944bfa4ce 100644
--- a/src/array.c
+++ b/src/array.c
@@ -104,7 +104,7 @@ ary_fill_with_nil(mrb_value *ptr, mrb_int size)
{
mrb_value nil = mrb_nil_value();
- while((int)(size--)) {
+ while ((int)(size--)) {
*ptr++ = nil;
}
}
@@ -166,7 +166,7 @@ ary_expand_capa(mrb_state *mrb, struct RArray *a, mrb_int len)
mrb_raise(mrb, E_ARGUMENT_ERROR, "array size too big");
}
- while(capa < len) {
+ while (capa < len) {
if (capa == 0) {
capa = ARY_DEFAULT_LEN;
}
@@ -180,7 +180,7 @@ ary_expand_capa(mrb_state *mrb, struct RArray *a, mrb_int len)
if (capa > a->aux.capa) {
mrb_value *expanded_ptr = (mrb_value *)mrb_realloc(mrb, a->ptr, sizeof(mrb_value)*capa);
- if(!expanded_ptr) {
+ if (!expanded_ptr) {
mrb_raise(mrb, E_RUNTIME_ERROR, "out of memory");
}
@@ -203,7 +203,7 @@ ary_shrink_capa(mrb_state *mrb, struct RArray *a)
capa = ARY_DEFAULT_LEN;
break;
}
- } while(capa > a->len * ARY_SHRINK_RATIO);
+ } while (capa > a->len * ARY_SHRINK_RATIO);
if (capa > a->len && capa < a->aux.capa) {
a->aux.capa = capa;
@@ -366,7 +366,7 @@ mrb_ary_times(mrb_state *mrb, mrb_value self)
ary = mrb_ary_new_capa(mrb, a1->len * times);
a2 = mrb_ary_ptr(ary);
ptr = a2->ptr;
- while(times--) {
+ while (times--) {
array_copy(ptr, a1->ptr, a1->len);
ptr += a1->len;
a2->len += a1->len;
@@ -387,7 +387,7 @@ mrb_ary_reverse_bang(mrb_state *mrb, mrb_value self)
p1 = a->ptr;
p2 = a->ptr + a->len - 1;
- while(p1 < p2) {
+ while (p1 < p2) {
mrb_value tmp = *p1;
*p1++ = *p2;
*p2-- = tmp;
@@ -410,7 +410,7 @@ mrb_ary_reverse(mrb_state *mrb, mrb_value self)
p1 = a->ptr;
e = p1 + a->len;
p2 = b->ptr + a->len - 1;
- while(p1 < e) {
+ while (p1 < e) {
*p2-- = *p1++;
}
b->len = a->len;
@@ -451,7 +451,7 @@ mrb_ary_push_m(mrb_state *mrb, mrb_value self)
int len;
mrb_get_args(mrb, "*", &argv, &len);
- while(len--) {
+ while (len--) {
mrb_ary_push(mrb, self, *argv++);
}
@@ -492,7 +492,7 @@ mrb_ary_shift(mrb_state *mrb, mrb_value self)
mrb_int size = a->len;
val = *ptr;
- while((int)(--size)) {
+ while ((int)(--size)) {
*ptr = *(ptr+1);
++ptr;
}
@@ -753,7 +753,7 @@ mrb_ary_delete_at(mrb_state *mrb, mrb_value self)
ptr = a->ptr + index;
len = a->len - index;
- while((int)(--len)) {
+ while ((int)(--len)) {
*ptr = *(ptr+1);
++ptr;
}
diff --git a/src/class.c b/src/class.c
index 380f3f145..ed0aeb45b 100644
--- a/src/class.c
+++ b/src/class.c
@@ -686,7 +686,7 @@ mrb_include_module(mrb_state *mrb, struct RClass *c, struct RClass *m)
struct RClass *p = c, *ic;
int superclass_seen = 0;
- while(p) {
+ while (p) {
if (c != p && p->tt == MRB_TT_CLASS) {
superclass_seen = 1;
}
diff --git a/src/dump.c b/src/dump.c
index 1d59e667b..209b0d369 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -320,11 +320,11 @@ get_debug_record_size(mrb_state *mrb, mrb_irep *irep)
size += sizeof(uint32_t); // record size
size += sizeof(uint16_t); // filename size
- if(irep->filename) {
+ if (irep->filename) {
size += strlen(irep->filename); // filename
}
size += sizeof(uint32_t); // niseq
- if(irep->lines) {
+ if (irep->lines) {
size += sizeof(uint16_t) * irep->ilen; // lineno
}
@@ -340,17 +340,17 @@ write_lineno_record(mrb_state *mrb, mrb_irep *irep, uint8_t* bin)
cur += sizeof(uint32_t); /* record size */
- if(irep->filename) {
+ if (irep->filename) {
filename_len = strlen(irep->filename);
}
cur += uint16_to_bin(filename_len, cur); /* filename size */
- if(filename_len) {
+ if (filename_len) {
memcpy(cur, irep->filename, filename_len);
cur += filename_len; /* filename */
}
- if(irep->lines) {
+ if (irep->lines) {
cur += uint32_to_bin(irep->ilen, cur); /* niseq */
for (iseq_no = 0; iseq_no < irep->ilen; iseq_no++) {
cur += uint16_to_bin(irep->lines[iseq_no], cur); /* opcode */
@@ -432,7 +432,7 @@ mrb_dump_irep(mrb_state *mrb, size_t start_index, int debug_info, uint8_t **bin,
section_size += section_irep_size;
/* DEBUG section size */
- if(debug_info) {
+ if (debug_info) {
section_lineno_size += sizeof(struct rite_section_lineno_header);
for (irep_no = start_index; irep_no < mrb->irep_len; irep_no++) {
section_lineno_size += get_debug_record_size(mrb, mrb->irep[irep_no]);
@@ -442,7 +442,7 @@ mrb_dump_irep(mrb_state *mrb, size_t start_index, int debug_info, uint8_t **bin,
*bin_size += sizeof(struct rite_binary_header) + section_size + sizeof(struct rite_binary_footer);
cur = *bin = (uint8_t *)mrb_malloc(mrb, *bin_size);
- if(cur == NULL) {
+ if (cur == NULL) {
goto error_exit;
}
@@ -456,7 +456,7 @@ mrb_dump_irep(mrb_state *mrb, size_t start_index, int debug_info, uint8_t **bin,
cur += section_irep_size;
/* write DEBUG section */
- if(debug_info) {
+ if (debug_info) {
result = mrb_write_section_lineno(mrb, start_index, cur);
if (result != MRB_DUMP_OK) {
goto error_exit;
diff --git a/src/load.c b/src/load.c
index c350cb1a3..27feea37f 100644
--- a/src/load.c
+++ b/src/load.c
@@ -271,11 +271,11 @@ read_rite_binary_header(const uint8_t *bin, size_t *bin_size, uint16_t *crc)
{
const struct rite_binary_header *header = (const struct rite_binary_header *)bin;
- if(memcmp(header->binary_identify, RITE_BINARY_IDENFIFIER, sizeof(header->binary_identify)) != 0) {
+ if (memcmp(header->binary_identify, RITE_BINARY_IDENFIFIER, sizeof(header->binary_identify)) != 0) {
return MRB_DUMP_INVALID_FILE_HEADER;
}
- if(memcmp(header->binary_version, RITE_BINARY_FORMAT_VER, sizeof(header->binary_version)) != 0) {
+ if (memcmp(header->binary_version, RITE_BINARY_FORMAT_VER, sizeof(header->binary_version)) != 0) {
return MRB_DUMP_INVALID_FILE_HEADER;
}
@@ -303,12 +303,12 @@ mrb_read_irep(mrb_state *mrb, const uint8_t *bin)
}
result = read_rite_binary_header(bin, &bin_size, &crc);
- if(result != MRB_DUMP_OK) {
+ if (result != MRB_DUMP_OK) {
return result;
}
n = offset_crc_body();
- if(crc != calc_crc_16_ccitt(bin + n, bin_size - n, 0)) {
+ if (crc != calc_crc_16_ccitt(bin + n, bin_size - n, 0)) {
return MRB_DUMP_INVALID_FILE_HEADER;
}
@@ -317,21 +317,21 @@ mrb_read_irep(mrb_state *mrb, const uint8_t *bin)
do {
section_header = (const struct rite_section_header *)bin;
- if(memcmp(section_header->section_identify, RITE_SECTION_IREP_IDENTIFIER, sizeof(section_header->section_identify)) == 0) {
+ if (memcmp(section_header->section_identify, RITE_SECTION_IREP_IDENTIFIER, sizeof(section_header->section_identify)) == 0) {
result = read_rite_section_irep(mrb, bin);
- if(result < MRB_DUMP_OK) {
+ if (result < MRB_DUMP_OK) {
return result;
}
total_nirep += result;
}
- else if(memcmp(section_header->section_identify, RITE_SECTION_LIENO_IDENTIFIER, sizeof(section_header->section_identify)) == 0) {
+ else if (memcmp(section_header->section_identify, RITE_SECTION_LIENO_IDENTIFIER, sizeof(section_header->section_identify)) == 0) {
result = read_rite_section_lineno(mrb, bin, sirep);
- if(result < MRB_DUMP_OK) {
+ if (result < MRB_DUMP_OK) {
return result;
}
}
bin += bin_to_uint32(section_header->section_size);
- } while(memcmp(section_header->section_identify, RITE_BINARY_EOF, sizeof(section_header->section_identify)) != 0);
+ } while (memcmp(section_header->section_identify, RITE_BINARY_EOF, sizeof(section_header->section_identify)) != 0);
return total_nirep;
}
@@ -509,7 +509,7 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
}
result = read_rite_binary_header(buf, NULL, &crc);
mrb_free(mrb, buf);
- if(result != MRB_DUMP_OK) {
+ if (result != MRB_DUMP_OK) {
return result;
}
@@ -517,14 +517,14 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
fpos = ftell(fp);
buf = mrb_malloc(mrb, block_size);
fseek(fp, offset_crc_body(), SEEK_SET);
- while((nbytes = fread(buf, 1, block_size, fp)) > 0) {
+ while ((nbytes = fread(buf, 1, block_size, fp)) > 0) {
crcwk = calc_crc_16_ccitt(buf, nbytes, crcwk);
}
mrb_free(mrb, buf);
if (nbytes == 0 && ferror(fp)) {
return MRB_DUMP_READ_FAULT;
}
- if(crcwk != crc) {
+ if (crcwk != crc) {
return MRB_DUMP_INVALID_FILE_HEADER;
}
fseek(fp, fpos + section_size, SEEK_SET);
@@ -538,24 +538,24 @@ mrb_read_irep_file(mrb_state *mrb, FILE* fp)
}
section_size = bin_to_uint32(section_header.section_size);
- if(memcmp(section_header.section_identify, RITE_SECTION_IREP_IDENTIFIER, sizeof(section_header.section_identify)) == 0) {
+ if (memcmp(section_header.section_identify, RITE_SECTION_IREP_IDENTIFIER, sizeof(section_header.section_identify)) == 0) {
fseek(fp, fpos, SEEK_SET);
result = read_rite_section_irep_file(mrb, fp);
- if(result < MRB_DUMP_OK) {
+ if (result < MRB_DUMP_OK) {
return result;
}
total_nirep += result;
}
- else if(memcmp(section_header.section_identify, RITE_SECTION_LIENO_IDENTIFIER, sizeof(section_header.section_identify)) == 0) {
+ else if (memcmp(section_header.section_identify, RITE_SECTION_LIENO_IDENTIFIER, sizeof(section_header.section_identify)) == 0) {
fseek(fp, fpos, SEEK_SET);
result = read_rite_section_lineno_file(mrb, fp, sirep);
- if(result < MRB_DUMP_OK) {
+ if (result < MRB_DUMP_OK) {
return result;
}
}
fseek(fp, fpos + section_size, SEEK_SET);
- } while(memcmp(section_header.section_identify, RITE_BINARY_EOF, sizeof(section_header.section_identify)) != 0);
+ } while (memcmp(section_header.section_identify, RITE_BINARY_EOF, sizeof(section_header.section_identify)) != 0);
return total_nirep;
}
diff --git a/src/string.c b/src/string.c
index c1ba2a655..860551ce8 100644
--- a/src/string.c
+++ b/src/string.c
@@ -30,7 +30,7 @@ static mrb_value mrb_str_subseq(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_
#define RESIZE_CAPA(s,capacity) do {\
s->ptr = (char *)mrb_realloc(mrb, s->ptr, (capacity)+1);\
s->aux.capa = capacity;\
-} while (0)
+} while(0)
void
mrb_str_decref(mrb_state *mrb, mrb_shared_string *shared)
diff --git a/src/vm.c b/src/vm.c
index e3c53d4a2..49f054f92 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -63,7 +63,7 @@ stack_clear(mrb_value *from, size_t count)
{
const mrb_value mrb_value_zero = { { 0 } };
- while(count-- > 0) {
+ while (count-- > 0) {
*from++ = mrb_value_zero;
}
}
@@ -1659,7 +1659,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
default:\
goto L_SEND;\
}\
-} while (0)
+} while(0)
CASE(OP_EQ) {
/* A B C R(A) := R(A)<R(A+1) (Syms[B]=:==,C=1)*/