From bc7aba9f57f455ecf77fd2e3d2623e4818328829 Mon Sep 17 00:00:00 2001 From: dinosaur Date: Thu, 2 Jan 2020 17:19:08 +0800 Subject: [PATCH 1/2] fix ulong conflicting --- include/SeasLog.h | 4 ++-- include/php7_wrapper.h | 9 ++++----- src/Buffer.c | 2 +- src/Common.c | 2 +- src/Logger.c | 2 +- src/StreamWrapper.c | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/include/SeasLog.h b/include/SeasLog.h index 6e61f49..8bf1992 100644 --- a/include/SeasLog.h +++ b/include/SeasLog.h @@ -155,7 +155,7 @@ typedef struct _logger_entry_t { - ulong logger_hash; + SEASLOG_ULONG logger_hash; char *folder; char *logger; int logger_len; @@ -168,7 +168,7 @@ typedef struct _stream_entry_t { char *opt; int opt_len; - ulong stream_entry_hash; + SEASLOG_ULONG stream_entry_hash; php_stream *stream; int can_delete; } stream_entry_t; diff --git a/include/php7_wrapper.h b/include/php7_wrapper.h index 331dade..54986bc 100644 --- a/include/php7_wrapper.h +++ b/include/php7_wrapper.h @@ -16,13 +16,12 @@ #ifndef _PHP_SEASLOG_PHP7_WRAPPER_H_ #define _PHP_SEASLOG_PHP7_WRAPPER_H_ -#if PHP_VERSION_ID >= 70000 - #if PHP_VERSION_ID >= 70400 -#ifndef ulong -typedef zend_ulong ulong; -#endif +typedef zend_ulong SEASLOG_ULONG; +#else +typedef ulong SEASLOG_ULONG; #endif +#if PHP_VERSION_ID >= 70000 #if PHP_VERSION_ID >= 70200 typedef uint32_t SEASLOG_UINT; diff --git a/src/Buffer.c b/src/Buffer.c index b1123ba..8bbad76 100644 --- a/src/Buffer.c +++ b/src/Buffer.c @@ -226,7 +226,7 @@ void seaslog_shutdown_buffer(int re_init TSRMLS_DC) while (zend_hash_get_current_data(ht, (void **)&ppzval) == SUCCESS) { char *key = NULL; - ulong idx = 0; + SEASLOG_ULONG idx = 0; zend_hash_get_current_key(ht, &key, &idx, 0); convert_to_array_ex(ppzval); diff --git a/src/Common.c b/src/Common.c index 7a8758e..0b87c24 100644 --- a/src/Common.c +++ b/src/Common.c @@ -192,7 +192,7 @@ char* php_strtr_array(char *str, int slen, HashTable *hash) zval **entry; char *string_key, *string_key_tmp = NULL; uint string_key_len; - ulong num_key; + SEASLOG_ULONG num_key; HashPosition hpos; char *tmp = estrdup(str); diff --git a/src/Logger.c b/src/Logger.c index e7f6a7d..ddc3d1b 100644 --- a/src/Logger.c +++ b/src/Logger.c @@ -177,7 +177,7 @@ void seaslog_clear_logger_list(TSRMLS_D) logger_entry_t *process_logger(char *logger, int logger_len, int last_or_tmp TSRMLS_DC) { - ulong logger_entry_hash = zend_inline_hash_func(logger, logger_len); + SEASLOG_ULONG logger_entry_hash = zend_inline_hash_func(logger, logger_len); logger_entry_t *logger_entry; HashTable *ht_list; HashTable *ht_logger; diff --git a/src/StreamWrapper.c b/src/StreamWrapper.c index 0cf00a9..c571bc2 100644 --- a/src/StreamWrapper.c +++ b/src/StreamWrapper.c @@ -111,7 +111,7 @@ int seaslog_clear_stream(int destroy, int model, char *opt TSRMLS_DC) #if PHP_VERSION_ID >= 70000 zend_ulong num_key; #else - ulong num_key; + SEASLOG_ULONG num_key; #endif #if PHP_VERSION_ID >= 70000 @@ -187,7 +187,7 @@ int seaslog_clear_stream(int destroy, int model, char *opt TSRMLS_DC) php_stream *process_stream(char *opt, int opt_len TSRMLS_DC) { - ulong stream_entry_hash; + SEASLOG_ULONG stream_entry_hash; php_stream *stream = NULL; HashTable *ht_list; php_stream_statbuf dest_s; From c483bc972a8ca96aab11238eed043868d2d32fd4 Mon Sep 17 00:00:00 2001 From: dinosaur Date: Fri, 3 Jan 2020 12:39:55 +0800 Subject: [PATCH 2/2] replace ulong by zend_ulong --- include/SeasLog.h | 4 ++-- include/php7_wrapper.h | 6 +----- src/Buffer.c | 2 +- src/Common.c | 2 +- src/Logger.c | 2 +- src/StreamWrapper.c | 6 +----- 6 files changed, 7 insertions(+), 15 deletions(-) diff --git a/include/SeasLog.h b/include/SeasLog.h index 8bf1992..556fbfd 100644 --- a/include/SeasLog.h +++ b/include/SeasLog.h @@ -155,7 +155,7 @@ typedef struct _logger_entry_t { - SEASLOG_ULONG logger_hash; + zend_ulong logger_hash; char *folder; char *logger; int logger_len; @@ -168,7 +168,7 @@ typedef struct _stream_entry_t { char *opt; int opt_len; - SEASLOG_ULONG stream_entry_hash; + zend_ulong stream_entry_hash; php_stream *stream; int can_delete; } stream_entry_t; diff --git a/include/php7_wrapper.h b/include/php7_wrapper.h index 54986bc..05cade7 100644 --- a/include/php7_wrapper.h +++ b/include/php7_wrapper.h @@ -16,11 +16,7 @@ #ifndef _PHP_SEASLOG_PHP7_WRAPPER_H_ #define _PHP_SEASLOG_PHP7_WRAPPER_H_ -#if PHP_VERSION_ID >= 70400 -typedef zend_ulong SEASLOG_ULONG; -#else -typedef ulong SEASLOG_ULONG; -#endif + #if PHP_VERSION_ID >= 70000 #if PHP_VERSION_ID >= 70200 diff --git a/src/Buffer.c b/src/Buffer.c index 8bbad76..e4604f5 100644 --- a/src/Buffer.c +++ b/src/Buffer.c @@ -226,7 +226,7 @@ void seaslog_shutdown_buffer(int re_init TSRMLS_DC) while (zend_hash_get_current_data(ht, (void **)&ppzval) == SUCCESS) { char *key = NULL; - SEASLOG_ULONG idx = 0; + zend_ulong idx = 0; zend_hash_get_current_key(ht, &key, &idx, 0); convert_to_array_ex(ppzval); diff --git a/src/Common.c b/src/Common.c index 0b87c24..84808d3 100644 --- a/src/Common.c +++ b/src/Common.c @@ -192,7 +192,7 @@ char* php_strtr_array(char *str, int slen, HashTable *hash) zval **entry; char *string_key, *string_key_tmp = NULL; uint string_key_len; - SEASLOG_ULONG num_key; + zend_ulong num_key; HashPosition hpos; char *tmp = estrdup(str); diff --git a/src/Logger.c b/src/Logger.c index ddc3d1b..2ddbe5c 100644 --- a/src/Logger.c +++ b/src/Logger.c @@ -177,7 +177,7 @@ void seaslog_clear_logger_list(TSRMLS_D) logger_entry_t *process_logger(char *logger, int logger_len, int last_or_tmp TSRMLS_DC) { - SEASLOG_ULONG logger_entry_hash = zend_inline_hash_func(logger, logger_len); + zend_ulong logger_entry_hash = zend_inline_hash_func(logger, logger_len); logger_entry_t *logger_entry; HashTable *ht_list; HashTable *ht_logger; diff --git a/src/StreamWrapper.c b/src/StreamWrapper.c index c571bc2..6d39b65 100644 --- a/src/StreamWrapper.c +++ b/src/StreamWrapper.c @@ -108,11 +108,7 @@ int seaslog_clear_stream(int destroy, int model, char *opt TSRMLS_DC) stream_entry_t *stream_entry; int result = FAILURE; -#if PHP_VERSION_ID >= 70000 zend_ulong num_key; -#else - SEASLOG_ULONG num_key; -#endif #if PHP_VERSION_ID >= 70000 if (IS_ARRAY == Z_TYPE(SEASLOG_G(stream_list))) @@ -187,7 +183,7 @@ int seaslog_clear_stream(int destroy, int model, char *opt TSRMLS_DC) php_stream *process_stream(char *opt, int opt_len TSRMLS_DC) { - SEASLOG_ULONG stream_entry_hash; + zend_ulong stream_entry_hash; php_stream *stream = NULL; HashTable *ht_list; php_stream_statbuf dest_s;