From 702a58e9e5b20a2450e753227112842bea8e7df6 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 6 Oct 2021 13:54:53 +0900 Subject: Remove duplicate type qualifiers `rb_encoding` is defined as `const OnigEncodingType`. Fix lots of C4114 warnings for each files by MSVC. --- include/ruby/internal/encoding/ctype.h | 22 +++++++++++----------- include/ruby/internal/encoding/encoding.h | 18 +++++++++--------- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'include/ruby') diff --git a/include/ruby/internal/encoding/ctype.h b/include/ruby/internal/encoding/ctype.h index 422e2b9c2d..64aaf0a990 100644 --- a/include/ruby/internal/encoding/ctype.h +++ b/include/ruby/internal/encoding/ctype.h @@ -40,7 +40,7 @@ RBIMPL_SYMBOL_EXPORT_BEGIN() * @retval otherwise It is. */ static inline bool -rb_enc_is_newline(const char *p, const char *e, const rb_encoding *enc) +rb_enc_is_newline(const char *p, const char *e, rb_encoding *enc) { OnigUChar *up = RBIMPL_CAST((OnigUChar *)p); OnigUChar *ue = RBIMPL_CAST((OnigUChar *)e); @@ -60,7 +60,7 @@ rb_enc_is_newline(const char *p, const char *e, const rb_encoding *enc) * @retval 0 Otherwise. */ static inline bool -rb_enc_isctype(OnigCodePoint c, OnigCtype t, const rb_encoding *enc) +rb_enc_isctype(OnigCodePoint c, OnigCtype t, rb_encoding *enc) { return ONIGENC_IS_CODE_CTYPE(enc, c, t); } @@ -79,7 +79,7 @@ rb_enc_isctype(OnigCodePoint c, OnigCtype t, const rb_encoding *enc) * (not a bug). But there could be rooms for future extensions. */ static inline bool -rb_enc_isascii(OnigCodePoint c, const rb_encoding *enc) +rb_enc_isascii(OnigCodePoint c, rb_encoding *enc) { return ONIGENC_IS_CODE_ASCII(c); } @@ -93,7 +93,7 @@ rb_enc_isascii(OnigCodePoint c, const rb_encoding *enc) * @retval 0 Otherwise. */ static inline bool -rb_enc_isalpha(OnigCodePoint c, const rb_encoding *enc) +rb_enc_isalpha(OnigCodePoint c, rb_encoding *enc) { return ONIGENC_IS_CODE_ALPHA(enc, c); } @@ -107,7 +107,7 @@ rb_enc_isalpha(OnigCodePoint c, const rb_encoding *enc) * @retval 0 Otherwise. */ static inline bool -rb_enc_islower(OnigCodePoint c, const rb_encoding *enc) +rb_enc_islower(OnigCodePoint c, rb_encoding *enc) { return ONIGENC_IS_CODE_LOWER(enc, c); } @@ -121,7 +121,7 @@ rb_enc_islower(OnigCodePoint c, const rb_encoding *enc) * @retval 0 Otherwise. */ static inline bool -rb_enc_isupper(OnigCodePoint c, const rb_encoding *enc) +rb_enc_isupper(OnigCodePoint c, rb_encoding *enc) { return ONIGENC_IS_CODE_UPPER(enc, c); } @@ -135,7 +135,7 @@ rb_enc_isupper(OnigCodePoint c, const rb_encoding *enc) * @retval 0 Otherwise. */ static inline bool -rb_enc_ispunct(OnigCodePoint c, const rb_encoding *enc) +rb_enc_ispunct(OnigCodePoint c, rb_encoding *enc) { return ONIGENC_IS_CODE_PUNCT(enc, c); } @@ -149,7 +149,7 @@ rb_enc_ispunct(OnigCodePoint c, const rb_encoding *enc) * @retval 0 Otherwise. */ static inline bool -rb_enc_isalnum(OnigCodePoint c, const rb_encoding *enc) +rb_enc_isalnum(OnigCodePoint c, rb_encoding *enc) { return ONIGENC_IS_CODE_ALNUM(enc, c); } @@ -163,7 +163,7 @@ rb_enc_isalnum(OnigCodePoint c, const rb_encoding *enc) * @retval 0 Otherwise. */ static inline bool -rb_enc_isprint(OnigCodePoint c, const rb_encoding *enc) +rb_enc_isprint(OnigCodePoint c, rb_encoding *enc) { return ONIGENC_IS_CODE_PRINT(enc, c); } @@ -177,7 +177,7 @@ rb_enc_isprint(OnigCodePoint c, const rb_encoding *enc) * @retval 0 Otherwise. */ static inline bool -rb_enc_isspace(OnigCodePoint c, const rb_encoding *enc) +rb_enc_isspace(OnigCodePoint c, rb_encoding *enc) { return ONIGENC_IS_CODE_SPACE(enc, c); } @@ -191,7 +191,7 @@ rb_enc_isspace(OnigCodePoint c, const rb_encoding *enc) * @retval 0 Otherwise. */ static inline bool -rb_enc_isdigit(OnigCodePoint c, const rb_encoding *enc) +rb_enc_isdigit(OnigCodePoint c, rb_encoding *enc) { return ONIGENC_IS_CODE_DIGIT(enc, c); } diff --git a/include/ruby/internal/encoding/encoding.h b/include/ruby/internal/encoding/encoding.h index b4274b7f55..33f7f27fc1 100644 --- a/include/ruby/internal/encoding/encoding.h +++ b/include/ruby/internal/encoding/encoding.h @@ -430,7 +430,7 @@ rb_encoding *rb_enc_find(const char *name); * @return Its name. */ static inline const char * -rb_enc_name(const rb_encoding *enc) +rb_enc_name(rb_encoding *enc) { return enc->name; } @@ -445,7 +445,7 @@ rb_enc_name(const rb_encoding *enc) * @return Its least possible number of bytes except 0. */ static inline int -rb_enc_mbminlen(const rb_encoding *enc) +rb_enc_mbminlen(rb_encoding *enc) { return enc->min_enc_len; } @@ -460,7 +460,7 @@ rb_enc_mbminlen(const rb_encoding *enc) * @return Its maximum possible number of bytes of a character. */ static inline int -rb_enc_mbmaxlen(const rb_encoding *enc) +rb_enc_mbmaxlen(rb_encoding *enc) { return enc->max_enc_len; } @@ -604,7 +604,7 @@ rb_enc_codepoint(const char *p, const char *e, rb_encoding *enc) * @return Code point of the character pointed by `p`. */ static inline OnigCodePoint -rb_enc_mbc_to_codepoint(const char *p, const char *e, const rb_encoding *enc) +rb_enc_mbc_to_codepoint(const char *p, const char *e, rb_encoding *enc) { const OnigUChar *up = RBIMPL_CAST((const OnigUChar *)p); const OnigUChar *ue = RBIMPL_CAST((const OnigUChar *)e); @@ -632,7 +632,7 @@ int rb_enc_codelen(int code, rb_encoding *enc); * @return otherwise Number of bytes used for `enc` to encode `code`. */ static inline int -rb_enc_code_to_mbclen(int c, const rb_encoding *enc) +rb_enc_code_to_mbclen(int c, rb_encoding *enc) { OnigCodePoint uc = RBIMPL_CAST((OnigCodePoint)c); @@ -654,7 +654,7 @@ rb_enc_code_to_mbclen(int c, const rb_encoding *enc) * being any stricter than this. :FIXME: */ static inline int -rb_enc_mbcput(unsigned int c, void *buf, const rb_encoding *enc) +rb_enc_mbcput(unsigned int c, void *buf, rb_encoding *enc) { OnigCodePoint uc = RBIMPL_CAST((OnigCodePoint)c); OnigUChar *ubuf = RBIMPL_CAST((OnigUChar *)buf); @@ -673,7 +673,7 @@ rb_enc_mbcput(unsigned int c, void *buf, const rb_encoding *enc) * @retval otherwise Pointer to the head of the previous character. */ static inline char * -rb_enc_prev_char(const char *s, const char *p, const char *e, const rb_encoding *enc) +rb_enc_prev_char(const char *s, const char *p, const char *e, rb_encoding *enc) { const OnigUChar *us = RBIMPL_CAST((const OnigUChar *)s); const OnigUChar *up = RBIMPL_CAST((const OnigUChar *)p); @@ -694,7 +694,7 @@ rb_enc_prev_char(const char *s, const char *p, const char *e, const rb_encoding * @return Pointer to the head of the character that contains `p`. */ static inline char * -rb_enc_left_char_head(const char *s, const char *p, const char *e, const rb_encoding *enc) +rb_enc_left_char_head(const char *s, const char *p, const char *e, rb_encoding *enc) { const OnigUChar *us = RBIMPL_CAST((const OnigUChar *)s); const OnigUChar *up = RBIMPL_CAST((const OnigUChar *)p); @@ -737,7 +737,7 @@ rb_enc_right_char_head(const char *s, const char *p, const char *e, rb_encoding * @retval otherwise Pointer to `n` character before `p`. */ static inline char * -rb_enc_step_back(const char *s, const char *p, const char *e, int n, const rb_encoding *enc) +rb_enc_step_back(const char *s, const char *p, const char *e, int n, rb_encoding *enc) { const OnigUChar *us = RBIMPL_CAST((const OnigUChar *)s); const OnigUChar *up = RBIMPL_CAST((const OnigUChar *)p); -- cgit v1.2.3