From 7963580d72a358975133f86f01de2d2eab08ba38 Mon Sep 17 00:00:00 2001 From: xXx-caillou-xXx Date: Fri, 13 Jul 2018 10:36:50 +0200 Subject: 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*`--- src/sp_sloppy.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/sp_sloppy.c') 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 @@ #include "sp_sloppy.h" -ZEND_API zend_op_array* (*zend_compile_file_default)(zend_file_handle* file_handle, int type) = NULL; -ZEND_API zend_op_array* (*zend_compile_string_default)(zval* source_string, char* filename) = NULL; +ZEND_API zend_op_array* (*zend_compile_file_default)( + zend_file_handle* file_handle, int type) = NULL; +ZEND_API zend_op_array* (*zend_compile_string_default)(zval* source_string, + char* filename) = NULL; static void modify_opcode(zend_op_array* opline) { if (NULL != opline) { @@ -24,7 +26,8 @@ ZEND_API zend_op_array* sp_compile_string(zval* source_string, char* filename) { return opline; } -ZEND_API zend_op_array* sp_compile_file(zend_file_handle* file_handle, int type) { +ZEND_API zend_op_array* sp_compile_file(zend_file_handle* file_handle, + int type) { zend_op_array* opline = zend_compile_file_default(file_handle, type); modify_opcode(opline); return opline; -- cgit v1.3