Skip to content

Commit

Permalink
Remove CHARSETNR_SIZE from generated headers
Browse files Browse the repository at this point in the history
and prefix it with MYSQL2_ to match existing definitions.
  • Loading branch information
felixbuenemann committed Apr 26, 2019
1 parent 624409d commit 2e5e334
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions ext/mysql2/mysql_enc_to_ruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,3 @@ static const char *mysql2_mysql_enc_to_rb[] = {
NULL,
"UTF-8"
};

#define CHARSETNR_SIZE (sizeof(mysql2_mysql_enc_to_rb)/sizeof(mysql2_mysql_enc_to_rb[0]))
3 changes: 2 additions & 1 deletion ext/mysql2/result.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <mysql2_ext.h>

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

static rb_encoding *binaryEncoding;

Expand Down Expand Up @@ -179,7 +180,7 @@ static VALUE mysql2_set_field_string_encoding(VALUE val, MYSQL_FIELD field, rb_e
const char *enc_name;
int enc_index;

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

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

0 comments on commit 2e5e334

Please sign in to comment.