1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* transcode_data.h (BYTE_LOOKUP_BASE): abstract accessor for

BYTE_LOOKUP.
  (BYTE_LOOKUP_INFO): ditto.

* transcode.c (transcode_restartable0): use BYTE_LOOKUP_BASE and
  BYTE_LOOKUP_INFO.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-09-01 14:33:56 +00:00
parent edf1d608c7
commit 2ae7b0328e
3 changed files with 15 additions and 3 deletions

View file

@ -1,3 +1,12 @@
Mon Sep 1 23:32:46 2008 Tanaka Akira <akr@fsij.org>
* transcode_data.h (BYTE_LOOKUP_BASE): abstract accessor for
BYTE_LOOKUP.
(BYTE_LOOKUP_INFO): ditto.
* transcode.c (transcode_restartable0): use BYTE_LOOKUP_BASE and
BYTE_LOOKUP_INFO.
Mon Sep 1 23:14:25 2008 Tanaka Akira <akr@fsij.org>
* tool/transcode-tblgen.rb: gather infos arrays and BYTE_LOOKUPs.

View file

@ -493,11 +493,11 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
next_byte = (unsigned char)*in_p++;
follow_byte:
if (next_byte < next_table->base[0] || next_table->base[1] < next_byte)
if (next_byte < BYTE_LOOKUP_BASE(next_table)[0] || BYTE_LOOKUP_BASE(next_table)[1] < next_byte)
next_info = INVALID;
else {
unsigned int next_offset = next_table->base[2+next_byte-next_table->base[0]];
next_info = (VALUE)next_table->info[next_offset];
unsigned int next_offset = BYTE_LOOKUP_BASE(next_table)[2+next_byte-BYTE_LOOKUP_BASE(next_table)[0]];
next_info = (VALUE)BYTE_LOOKUP_INFO(next_table)[next_offset];
}
follow_info:
switch (next_info & 0x1F) {

View file

@ -21,6 +21,9 @@ typedef struct byte_lookup {
const struct byte_lookup *const *info;
} BYTE_LOOKUP;
#define BYTE_LOOKUP_BASE(bl) ((bl)->base)
#define BYTE_LOOKUP_INFO(bl) ((bl)->info)
#ifndef PType
/* data file needs to treat this as a pointer, to remove warnings */
#define PType (const BYTE_LOOKUP *)