summaryrefslogtreecommitdiff
path: root/ext/nkf
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-07-21 09:23:58 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2022-07-21 09:42:04 -0700
commit5b21e94bebed90180d8ff63dad03b8b948361089 (patch)
treef9f7196d84b51b7a3a8001658e4391a63b71c396 /ext/nkf
parent3ff53c8e04ecc91e0190de6d5950ecce2a2ea188 (diff)
Expand tabs [ci skip]
[Misc #18891]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6094
Diffstat (limited to 'ext/nkf')
-rw-r--r--ext/nkf/nkf.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
index a8fd937c31..c6ddee1976 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -65,11 +65,11 @@ rb_encoding* rb_nkf_enc_get(const char *name)
{
int idx = rb_enc_find_index(name);
if (idx < 0) {
- nkf_encoding *nkf_enc = nkf_enc_find(name);
- idx = rb_enc_find_index(nkf_enc_name(nkf_enc_to_base_encoding(nkf_enc)));
- if (idx < 0) {
- idx = rb_define_dummy_encoding(name);
- }
+ nkf_encoding *nkf_enc = nkf_enc_find(name);
+ idx = rb_enc_find_index(nkf_enc_name(nkf_enc_to_base_encoding(nkf_enc)));
+ if (idx < 0) {
+ idx = rb_define_dummy_encoding(name);
+ }
}
return rb_enc_from_index(idx);
}
@@ -83,40 +83,40 @@ int nkf_split_options(const char *arg)
int is_single_quoted = FALSE;
int is_double_quoted = FALSE;
for(i = 0; arg[i]; i++){
- if(j == 255){
- return -1;
- }else if(is_single_quoted){
- if(arg[i] == '\''){
- is_single_quoted = FALSE;
- }else{
- option[j++] = arg[i];
- }
- }else if(is_escaped){
- is_escaped = FALSE;
- option[j++] = arg[i];
- }else if(arg[i] == '\\'){
- is_escaped = TRUE;
- }else if(is_double_quoted){
- if(arg[i] == '"'){
- is_double_quoted = FALSE;
- }else{
- option[j++] = arg[i];
- }
- }else if(arg[i] == '\''){
- is_single_quoted = TRUE;
- }else if(arg[i] == '"'){
- is_double_quoted = TRUE;
- }else if(arg[i] == ' '){
- option[j] = '\0';
- options(option);
- j = 0;
- }else{
- option[j++] = arg[i];
- }
+ if(j == 255){
+ return -1;
+ }else if(is_single_quoted){
+ if(arg[i] == '\''){
+ is_single_quoted = FALSE;
+ }else{
+ option[j++] = arg[i];
+ }
+ }else if(is_escaped){
+ is_escaped = FALSE;
+ option[j++] = arg[i];
+ }else if(arg[i] == '\\'){
+ is_escaped = TRUE;
+ }else if(is_double_quoted){
+ if(arg[i] == '"'){
+ is_double_quoted = FALSE;
+ }else{
+ option[j++] = arg[i];
+ }
+ }else if(arg[i] == '\''){
+ is_single_quoted = TRUE;
+ }else if(arg[i] == '"'){
+ is_double_quoted = TRUE;
+ }else if(arg[i] == ' '){
+ option[j] = '\0';
+ options(option);
+ j = 0;
+ }else{
+ option[j++] = arg[i];
+ }
}
if(j){
- option[j] = '\0';
- options(option);
+ option[j] = '\0';
+ options(option);
}
return count;
}
@@ -170,9 +170,9 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
rb_str_set_len(tmp, output_ctr);
if (mimeout_f)
- rb_enc_associate(tmp, rb_usascii_encoding());
+ rb_enc_associate(tmp, rb_usascii_encoding());
else
- rb_enc_associate(tmp, rb_nkf_enc_get(nkf_enc_name(output_encoding)));
+ rb_enc_associate(tmp, rb_nkf_enc_get(nkf_enc_name(output_encoding)));
return tmp;
}