[前][次][番号順一覧][スレッド一覧]

ruby-changes:72911

From: Nobuyoshi <ko1@a...>
Date: Fri, 12 Aug 2022 15:56:41 +0900 (JST)
Subject: [ruby-changes:72911] a201cfd0cd (master): Add missing `rb_enc_iscntrl`

https://git.ruby-lang.org/ruby.git/commit/?id=a201cfd0cd

From a201cfd0cdb9f613f687dc6fee1908ec54e63c72 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 12 Aug 2022 13:36:11 +0900
Subject: Add missing `rb_enc_iscntrl`

---
 include/ruby/internal/encoding/ctype.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/ruby/internal/encoding/ctype.h b/include/ruby/internal/encoding/ctype.h
index 70b6cc7909..05c314aeb3 100644
--- a/include/ruby/internal/encoding/ctype.h
+++ b/include/ruby/internal/encoding/ctype.h
@@ -126,6 +126,20 @@ rb_enc_isupper(OnigCodePoint c, rb_encoding *enc) https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/encoding/ctype.h#L126
     return ONIGENC_IS_CODE_UPPER(enc, c);
 }
 
+/**
+ * Identical to rb_iscntrl(), except it additionally takes an encoding.
+ *
+ * @param[in]  c          A code point.
+ * @param[in]  enc        An encoding.
+ * @retval     true       `enc` classifies `c` as "CNTRL".
+ * @retval     false      Otherwise.
+ */
+static inline bool
+rb_enc_iscntrl(OnigCodePoint c, rb_encoding *enc)
+{
+    return ONIGENC_IS_CODE_CNTRL(enc, c);
+}
+
 /**
  * Identical to rb_ispunct(), except it additionally takes an encoding.
  *
@@ -235,6 +249,7 @@ RBIMPL_SYMBOL_EXPORT_END() https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/encoding/ctype.h#L249
 #define rb_enc_isdigit    rb_enc_isdigit
 #define rb_enc_islower    rb_enc_islower
 #define rb_enc_isprint    rb_enc_isprint
+#define rb_enc_iscntrl    rb_enc_iscntrl
 #define rb_enc_ispunct    rb_enc_ispunct
 #define rb_enc_isspace    rb_enc_isspace
 #define rb_enc_isupper    rb_enc_isupper
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]