Skip to content

Commit 4e8e82f

Browse files
committed
Adjust styles [ci skip]
1 parent 17ee957 commit 4e8e82f

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

ext/stringio/stringio.c

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,13 @@ static void
176176
check_modifiable(struct StringIO *ptr)
177177
{
178178
if (NIL_P(ptr->string)) {
179-
/* Null device StringIO */
179+
/* Null device StringIO */
180180
}
181181
else if (rb_str_chilled_p(ptr->string)) {
182-
rb_str_modify(ptr->string);
182+
rb_str_modify(ptr->string);
183183
}
184184
else if (OBJ_FROZEN_RAW(ptr->string)) {
185-
rb_raise(rb_eIOError, "not modifiable string");
185+
rb_raise(rb_eIOError, "not modifiable string");
186186
}
187187
}
188188

@@ -989,10 +989,10 @@ strio_ungetbyte(VALUE self, VALUE c)
989989
if (NIL_P(ptr->string)) return Qnil;
990990
if (NIL_P(c)) return Qnil;
991991
if (RB_INTEGER_TYPE_P(c)) {
992-
/* rb_int_and() not visible from exts */
993-
VALUE v = rb_funcall(c, '&', 1, INT2FIX(0xff));
994-
const char cc = NUM2INT(v) & 0xFF;
995-
strio_unget_bytes(ptr, &cc, 1);
992+
/* rb_int_and() not visible from exts */
993+
VALUE v = rb_funcall(c, '&', 1, INT2FIX(0xff));
994+
const char cc = NUM2INT(v) & 0xFF;
995+
strio_unget_bytes(ptr, &cc, 1);
996996
}
997997
else {
998998
long cl;
@@ -1173,41 +1173,41 @@ prepare_getline_args(struct StringIO *ptr, struct getline_arg *arg, int argc, VA
11731173
break;
11741174

11751175
case 1:
1176-
if (!NIL_P(rs) && !RB_TYPE_P(rs, T_STRING)) {
1177-
VALUE tmp = rb_check_string_type(rs);
1176+
if (!NIL_P(rs) && !RB_TYPE_P(rs, T_STRING)) {
1177+
VALUE tmp = rb_check_string_type(rs);
11781178
if (NIL_P(tmp)) {
1179-
limit = NUM2LONG(rs);
1180-
rs = rb_rs;
1179+
limit = NUM2LONG(rs);
1180+
rs = rb_rs;
11811181
}
11821182
else {
1183-
rs = tmp;
1183+
rs = tmp;
11841184
}
11851185
}
11861186
break;
11871187

11881188
case 2:
1189-
if (!NIL_P(rs)) StringValue(rs);
1189+
if (!NIL_P(rs)) StringValue(rs);
11901190
if (!NIL_P(lim)) limit = NUM2LONG(lim);
11911191
break;
11921192
}
11931193
if (!NIL_P(ptr->string) && !NIL_P(rs)) {
1194-
rb_encoding *enc_rs, *enc_io;
1195-
enc_rs = rb_enc_get(rs);
1196-
enc_io = get_enc(ptr);
1197-
if (enc_rs != enc_io &&
1198-
(rb_enc_str_coderange(rs) != ENC_CODERANGE_7BIT ||
1199-
(RSTRING_LEN(rs) > 0 && !rb_enc_asciicompat(enc_io)))) {
1200-
if (rs == rb_rs) {
1201-
rs = rb_enc_str_new(0, 0, enc_io);
1202-
rb_str_buf_cat_ascii(rs, "\n");
1203-
rs = rs;
1204-
}
1205-
else {
1206-
rb_raise(rb_eArgError, "encoding mismatch: %s IO with %s RS",
1207-
rb_enc_name(enc_io),
1208-
rb_enc_name(enc_rs));
1209-
}
1210-
}
1194+
rb_encoding *enc_rs, *enc_io;
1195+
enc_rs = rb_enc_get(rs);
1196+
enc_io = get_enc(ptr);
1197+
if (enc_rs != enc_io &&
1198+
(rb_enc_str_coderange(rs) != ENC_CODERANGE_7BIT ||
1199+
(RSTRING_LEN(rs) > 0 && !rb_enc_asciicompat(enc_io)))) {
1200+
if (rs == rb_rs) {
1201+
rs = rb_enc_str_new(0, 0, enc_io);
1202+
rb_str_buf_cat_ascii(rs, "\n");
1203+
rs = rs;
1204+
}
1205+
else {
1206+
rb_raise(rb_eArgError, "encoding mismatch: %s IO with %s RS",
1207+
rb_enc_name(enc_io),
1208+
rb_enc_name(enc_rs));
1209+
}
1210+
}
12111211
}
12121212
arg->rs = rs;
12131213
arg->limit = limit;
@@ -1219,9 +1219,9 @@ prepare_getline_args(struct StringIO *ptr, struct getline_arg *arg, int argc, VA
12191219
keywords[0] = rb_intern_const("chomp");
12201220
}
12211221
rb_get_kwargs(opts, keywords, 0, 1, &vchomp);
1222-
if (respect_chomp) {
1222+
if (respect_chomp) {
12231223
arg->chomp = (vchomp != Qundef) && RTEST(vchomp);
1224-
}
1224+
}
12251225
}
12261226
return arg;
12271227
}
@@ -1261,7 +1261,7 @@ strio_getline(struct getline_arg *arg, struct StringIO *ptr)
12611261
str = strio_substr(ptr, ptr->pos, e - s - w, enc);
12621262
}
12631263
else if ((n = RSTRING_LEN(str)) == 0) {
1264-
const char *paragraph_end = NULL;
1264+
const char *paragraph_end = NULL;
12651265
p = s;
12661266
while (p[(p + 1 < e) && (*p == '\r') && 0] == '\n') {
12671267
p += *p == '\r';
@@ -1271,18 +1271,18 @@ strio_getline(struct getline_arg *arg, struct StringIO *ptr)
12711271
}
12721272
s = p;
12731273
while ((p = memchr(p, '\n', e - p)) && (p != e)) {
1274-
p++;
1275-
if (!((p < e && *p == '\n') ||
1276-
(p + 1 < e && *p == '\r' && *(p+1) == '\n'))) {
1277-
continue;
1278-
}
1279-
paragraph_end = p - ((*(p-2) == '\r') ? 2 : 1);
1280-
while ((p < e && *p == '\n') ||
1281-
(p + 1 < e && *p == '\r' && *(p+1) == '\n')) {
1282-
p += (*p == '\r') ? 2 : 1;
1283-
}
1284-
e = p;
1285-
break;
1274+
p++;
1275+
if (!((p < e && *p == '\n') ||
1276+
(p + 1 < e && *p == '\r' && *(p+1) == '\n'))) {
1277+
continue;
1278+
}
1279+
paragraph_end = p - ((*(p-2) == '\r') ? 2 : 1);
1280+
while ((p < e && *p == '\n') ||
1281+
(p + 1 < e && *p == '\r' && *(p+1) == '\n')) {
1282+
p += (*p == '\r') ? 2 : 1;
1283+
}
1284+
e = p;
1285+
break;
12861286
}
12871287
if (arg->chomp && paragraph_end) {
12881288
w = e - paragraph_end;
@@ -1606,7 +1606,7 @@ strio_read(int argc, VALUE *argv, VALUE self)
16061606
}
16071607
break;
16081608
default:
1609-
rb_error_arity(argc, 0, 2);
1609+
rb_error_arity(argc, 0, 2);
16101610
}
16111611
if (NIL_P(str)) {
16121612
rb_encoding *enc = binary ? rb_ascii8bit_encoding() : get_enc(ptr);
@@ -1642,28 +1642,28 @@ strio_pread(int argc, VALUE *argv, VALUE self)
16421642
long offset = NUM2LONG(rb_offset);
16431643

16441644
if (len < 0) {
1645-
rb_raise(rb_eArgError, "negative string size (or size too big): %" PRIsVALUE, rb_len);
1645+
rb_raise(rb_eArgError, "negative string size (or size too big): %" PRIsVALUE, rb_len);
16461646
}
16471647

16481648
if (len == 0) {
1649-
if (NIL_P(rb_buf)) {
1650-
return rb_str_new("", 0);
1651-
}
1652-
return rb_buf;
1649+
if (NIL_P(rb_buf)) {
1650+
return rb_str_new("", 0);
1651+
}
1652+
return rb_buf;
16531653
}
16541654

16551655
if (offset < 0) {
1656-
rb_syserr_fail_str(EINVAL, rb_sprintf("pread: Invalid offset argument: %" PRIsVALUE, rb_offset));
1656+
rb_syserr_fail_str(EINVAL, rb_sprintf("pread: Invalid offset argument: %" PRIsVALUE, rb_offset));
16571657
}
16581658

16591659
struct StringIO *ptr = readable(self);
16601660

16611661
if (offset >= RSTRING_LEN(ptr->string)) {
1662-
rb_eof_error();
1662+
rb_eof_error();
16631663
}
16641664

16651665
if (NIL_P(rb_buf)) {
1666-
return strio_substr(ptr, offset, len, rb_ascii8bit_encoding());
1666+
return strio_substr(ptr, offset, len, rb_ascii8bit_encoding());
16671667
}
16681668

16691669
long rest = RSTRING_LEN(ptr->string) - offset;

0 commit comments

Comments
 (0)