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_session.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_session.c')
| -rw-r--r-- | src/sp_session.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sp_session.c b/src/sp_session.c index ce852ad..ea65f57 100644 --- a/src/sp_session.c +++ b/src/sp_session.c | |||
| @@ -51,7 +51,7 @@ static int sp_hook_s_read(PS_READ_ARGS) { | |||
| 51 | 51 | ||
| 52 | static int sp_hook_s_write(PS_WRITE_ARGS) { | 52 | static int sp_hook_s_write(PS_WRITE_ARGS) { |
| 53 | if (ZSTR_LEN(val) > 0 && SNUFFLEUPAGUS_G(config).config_session->encrypt) { | 53 | if (ZSTR_LEN(val) > 0 && SNUFFLEUPAGUS_G(config).config_session->encrypt) { |
| 54 | zend_string *new_val = encrypt_zval(ZSTR_VAL(val), ZSTR_LEN(val)); | 54 | zend_string *new_val = encrypt_zval(val); |
| 55 | return old_s_write(mod_data, key, new_val, maxlifetime); | 55 | return old_s_write(mod_data, key, new_val, maxlifetime); |
| 56 | } | 56 | } |
| 57 | return old_s_write(mod_data, key, val, maxlifetime); | 57 | return old_s_write(mod_data, key, val, maxlifetime); |
| @@ -150,4 +150,4 @@ void hook_session() { | |||
| 150 | s_module = NULL; | 150 | s_module = NULL; |
| 151 | 151 | ||
| 152 | sp_hook_session_module(); | 152 | sp_hook_session_module(); |
| 153 | } \ No newline at end of file | 153 | } |
