diff options
| author | xXx-caillou-xXx | 2018-07-13 10:36:50 +0200 |
|---|---|---|
| committer | jvoisin | 2018-07-13 08:36:50 +0000 |
| commit | 7963580d72a358975133f86f01de2d2eab08ba38 (patch) | |
| tree | 4bec345d70f687a2a6002b36e2f2fc79318959f6 /src/sp_sloppy.c | |
| parent | 12b740bc7bb01ffe397cecc5b6fa25b136304911 (diff) | |
Massively optimize how rules are handled
This commit does a lot of things:
- Use hashtables instead of lists to store the rules
- Rules that can be applied at launch time won't be tried at runtime
- Improve feedback when writing nonsensical rules
- Make intensive use of `zend_string` instead of `char*`
Diffstat (limited to 'src/sp_sloppy.c')
| -rw-r--r-- | src/sp_sloppy.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/sp_sloppy.c b/src/sp_sloppy.c index 05d2505..09e79d8 100644 --- a/src/sp_sloppy.c +++ b/src/sp_sloppy.c | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | #include "sp_sloppy.h" | 1 | #include "sp_sloppy.h" |
| 2 | 2 | ||
| 3 | ZEND_API zend_op_array* (*zend_compile_file_default)(zend_file_handle* file_handle, int type) = NULL; | 3 | ZEND_API zend_op_array* (*zend_compile_file_default)( |
| 4 | ZEND_API zend_op_array* (*zend_compile_string_default)(zval* source_string, char* filename) = NULL; | 4 | zend_file_handle* file_handle, int type) = NULL; |
| 5 | ZEND_API zend_op_array* (*zend_compile_string_default)(zval* source_string, | ||
| 6 | char* filename) = NULL; | ||
| 5 | 7 | ||
| 6 | static void modify_opcode(zend_op_array* opline) { | 8 | static void modify_opcode(zend_op_array* opline) { |
| 7 | if (NULL != opline) { | 9 | if (NULL != opline) { |
| @@ -24,7 +26,8 @@ ZEND_API zend_op_array* sp_compile_string(zval* source_string, char* filename) { | |||
| 24 | return opline; | 26 | return opline; |
| 25 | } | 27 | } |
| 26 | 28 | ||
| 27 | ZEND_API zend_op_array* sp_compile_file(zend_file_handle* file_handle, int type) { | 29 | ZEND_API zend_op_array* sp_compile_file(zend_file_handle* file_handle, |
| 30 | int type) { | ||
| 28 | zend_op_array* opline = zend_compile_file_default(file_handle, type); | 31 | zend_op_array* opline = zend_compile_file_default(file_handle, type); |
| 29 | modify_opcode(opline); | 32 | modify_opcode(opline); |
| 30 | return opline; | 33 | return opline; |
