Skip to content

Commit 2e5e334

Browse files
Remove CHARSETNR_SIZE from generated headers
and prefix it with MYSQL2_ to match existing definitions.
1 parent 624409d commit 2e5e334

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

ext/mysql2/mysql_enc_to_ruby.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,5 +255,3 @@ static const char *mysql2_mysql_enc_to_rb[] = {
255255
NULL,
256256
"UTF-8"
257257
};
258-
259-
#define CHARSETNR_SIZE (sizeof(mysql2_mysql_enc_to_rb)/sizeof(mysql2_mysql_enc_to_rb[0]))

ext/mysql2/result.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <mysql2_ext.h>
22

33
#include "mysql_enc_to_ruby.h"
4+
#define MYSQL2_CHARSETNR_SIZE (sizeof(mysql2_mysql_enc_to_rb)/sizeof(mysql2_mysql_enc_to_rb[0]))
45

56
static rb_encoding *binaryEncoding;
67

@@ -179,7 +180,7 @@ static VALUE mysql2_set_field_string_encoding(VALUE val, MYSQL_FIELD field, rb_e
179180
const char *enc_name;
180181
int enc_index;
181182

182-
enc_name = (field.charsetnr-1 < CHARSETNR_SIZE) ? mysql2_mysql_enc_to_rb[field.charsetnr-1] : NULL;
183+
enc_name = (field.charsetnr-1 < MYSQL2_CHARSETNR_SIZE) ? mysql2_mysql_enc_to_rb[field.charsetnr-1] : NULL;
183184

184185
if (enc_name != NULL) {
185186
/* use the field encoding we were able to match */

0 commit comments

Comments
 (0)