summaryrefslogtreecommitdiffhomepage
path: root/src/transcode.c
diff options
context:
space:
mode:
authorMitchell Blank Jr <[email protected]>2012-05-19 22:40:57 -0700
committerMitchell Blank Jr <[email protected]>2012-05-19 22:40:57 -0700
commit3471e2b1340cb84504272da26051f149f350ee94 (patch)
tree3e84410470fb2f98bd5369511c53901c612d0b0d /src/transcode.c
parent4105b595684bb9f1e176563f819de2917d0471fd (diff)
downloadmruby-3471e2b1340cb84504272da26051f149f350ee94.tar.gz
mruby-3471e2b1340cb84504272da26051f149f350ee94.zip
C++ compilability - don't define types inside others
The following is legal code in both C and C++: struct foo { struct bar { int a } x; int y; }; ...however in C++ it defines a type called "foo::bar" instead of "bar". Just avoid this construct altogether
Diffstat (limited to 'src/transcode.c')
-rw-r--r--src/transcode.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/transcode.c b/src/transcode.c
index 42c86d167..d6d41b667 100644
--- a/src/transcode.c
+++ b/src/transcode.c
@@ -65,6 +65,12 @@ allocate_converted_string(mrb_state *mrb,
unsigned char *caller_dst_buf, size_t caller_dst_bufsize,
size_t *dst_len_ptr);
+union mrb_transcoding_state_t { /* opaque data for stateful encoding */
+ void *ptr;
+ char ary[sizeof(double) > sizeof(void*) ? sizeof(double) : sizeof(void*)];
+ double dummy_for_alignment;
+};
+
/* dynamic structure, one per conversion (similar to iconv_t) */
/* may carry conversion state (e.g. for iso-2022-jp) */
typedef struct mrb_transcoding {
@@ -92,11 +98,7 @@ typedef struct mrb_transcoding {
unsigned char *ptr; /* length: max_output */
} writebuf;
- union mrb_transcoding_state_t { /* opaque data for stateful encoding */
- void *ptr;
- char ary[sizeof(double) > sizeof(void*) ? sizeof(double) : sizeof(void*)];
- double dummy_for_alignment;
- } state;
+ union mrb_transcoding_state_t state;
} mrb_transcoding;
#define TRANSCODING_READBUF(tc) \
((tc)->transcoder->max_input <= (int)sizeof((tc)->readbuf.ary) ? \