From: K.Kosako Date: Thu, 7 Feb 2019 04:45:45 +0000 (+0900) Subject: opcode member to be coexists with opaddr member if ONIG_DEBUG is enabled. X-Git-Tag: v6.9.2_rc1~65^2~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02b9fc627b8a09b2d0639b0bdfe7fb21f77537d7;p=onig opcode member to be coexists with opaddr member if ONIG_DEBUG is enabled. --- diff --git a/src/regexec.c b/src/regexec.c index b5c2b8d..d110cac 100644 --- a/src/regexec.c +++ b/src/regexec.c @@ -2372,7 +2372,7 @@ typedef struct { #define BYTECODE_INTERPRETER_START GOTO_OP; #define BYTECODE_INTERPRETER_END -#define CASE_OP(x) L_##x: SOP_IN(OP_##x); sbegin = s; MATCH_DEBUG_OUT(1) +#define CASE_OP(x) L_##x: SOP_IN(OP_##x); sbegin = s; MATCH_DEBUG_OUT(0) #define DEFAULT_OP /* L_DEFAULT: */ #define NEXT_OP sprev = sbegin; JUMP_OP #define JUMP_OP GOTO_OP @@ -2409,7 +2409,8 @@ typedef struct { #ifdef ONIG_DEBUG_MATCH #define MATCH_DEBUG_OUT(offset) do {\ - UChar *xp, *q, *bp, buf[50];\ + Operation *xp;\ + UChar *q, *bp, buf[50];\ int len, spos;\ spos = IS_NOT_NULL(s) ? (int )(s - str) : -1;\ xp = p - (offset);\ @@ -2434,8 +2435,8 @@ typedef struct { if (xp == FinishCode)\ fprintf(stderr, "----: ");\ else\ - fprintf(stderr, "%4d: ", (int )(xp - reg->p));\ - onig_print_compiled_byte_code(stderr, xp, reg->p, encode);\ + fprintf(stderr, "%4d: ", (int )(xp - reg->ops));\ + onig_print_compiled_byte_code(stderr, xp, reg->ops, encode);\ fprintf(stderr, "\n");\ } while(0); #else @@ -2451,11 +2452,19 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, MatchArg* msa) { +#ifdef ONIG_DEBUG +#if defined(USE_THREADED_CODE) && defined(USE_DIRECT_THREADED_CODE) + static Operation FinishCode[] = { {.opcode=OP_FINISH, .opaddr=&&L_FINISH } }; +#else + static Operation FinishCode[] = { {OP_FINISH } }; +#endif +#else #if defined(USE_THREADED_CODE) && defined(USE_DIRECT_THREADED_CODE) - static Operation FinishCode[] = { { {.opaddr=&&L_FINISH} } }; + static Operation FinishCode[] = { { {.opcode=OP_FINISH, .opaddr=&&L_FINISH} } }; #else static Operation FinishCode[] = { { {OP_FINISH} } }; #endif +#endif #ifdef USE_THREADED_CODE static const void *opcode_to_label[] = { diff --git a/src/regint.h b/src/regint.h index f8ba337..b10bb4f 100644 --- a/src/regint.h +++ b/src/regint.h @@ -798,10 +798,15 @@ typedef int ModeType; typedef struct { +#ifdef ONIG_DEBUG + enum OpCode opcode; + const void* opaddr; +#else union { enum OpCode opcode; const void* opaddr; }; +#endif union { struct { UChar* s; @@ -923,16 +928,10 @@ typedef struct { struct re_pattern_buffer { /* common members of BBuf(bytes-buffer) */ -#if 0 - unsigned char* p; /* compiled pattern */ - unsigned int used; /* used space for p */ - unsigned int alloc; /* allocated space for p */ -#else Operation* ops; Operation* ops_curr; unsigned int ops_used; /* used space for ops */ unsigned int ops_alloc; /* allocated space for ops */ -#endif int num_mem; /* used memory(...) num counted from 1 */ int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */