diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-05-29 09:39:03 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-05-29 09:39:03 -0300 |
commit | 44fab2a44d06a956c3121ceba2b39ca7b00dc428 (patch) | |
tree | 9f492ba2ebaa4fb3cf6554fcb63f3fe026d43a5d /lpprint.c | |
parent | 460a35cbcb33fbc56f5a658b96a793b9bb8963e9 (diff) | |
download | lpeg-44fab2a44d06a956c3121ceba2b39ca7b00dc428.tar.gz lpeg-44fab2a44d06a956c3121ceba2b39ca7b00dc428.tar.bz2 lpeg-44fab2a44d06a956c3121ceba2b39ca7b00dc428.zip |
Code size stored in code itself
Most patterns do not have code, as they are not directly used for
a match; they are created only to compose larger patterns. So, we
shouldn't waste space to store the size of their code, as a NULL
pointer already indicates that the size is zero.
Diffstat (limited to 'lpprint.c')
-rw-r--r-- | lpprint.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -137,8 +137,9 @@ void printinst (const Instruction *op, const Instruction *p) { | |||
137 | } | 137 | } |
138 | 138 | ||
139 | 139 | ||
140 | void printpatt (Instruction *p, int n) { | 140 | void printpatt (Instruction *p) { |
141 | Instruction *op = p; | 141 | Instruction *op = p; |
142 | uint n = op[-1].codesize - 1; | ||
142 | while (p < op + n) { | 143 | while (p < op + n) { |
143 | printinst(op, p); | 144 | printinst(op, p); |
144 | p += sizei(p); | 145 | p += sizei(p); |