@@ -107,10 +107,10 @@ int php_memc_list_entry(void)
107
107
#define MEMC_VAL_COMPRESSION_ZLIB (1<<1)
108
108
#define MEMC_VAL_COMPRESSION_FASTLZ (1<<2)
109
109
110
- #define MEMC_VAL_GET_FLAGS (internal_flags ) ((internal_flags & MEMC_MASK_INTERNAL) >> 4)
111
- #define MEMC_VAL_SET_FLAG (internal_flags , internal_flag ) ((internal_flags) |= ((internal_flag << 4) & MEMC_MASK_INTERNAL))
112
- #define MEMC_VAL_HAS_FLAG (internal_flags , internal_flag ) ((MEMC_VAL_GET_FLAGS(internal_flags) & internal_flag) == internal_flag)
113
- #define MEMC_VAL_DEL_FLAG (internal_flags , internal_flag ) internal_flags &= ~((internal_flag << 4) & MEMC_MASK_INTERNAL)
110
+ #define MEMC_VAL_GET_FLAGS (internal_flags ) ((( internal_flags) & MEMC_MASK_INTERNAL) >> 4)
111
+ #define MEMC_VAL_SET_FLAG (internal_flags , internal_flag ) ((internal_flags) |= ((( internal_flag) << 4) & MEMC_MASK_INTERNAL))
112
+ #define MEMC_VAL_HAS_FLAG (internal_flags , internal_flag ) ((MEMC_VAL_GET_FLAGS(internal_flags) & ( internal_flag)) == ( internal_flag) )
113
+ #define MEMC_VAL_DEL_FLAG (internal_flags , internal_flag ) ( internal_flags &= ( ~((( internal_flag) << 4) & MEMC_MASK_INTERNAL)) )
114
114
115
115
/****************************************
116
116
User-defined flags
@@ -822,7 +822,7 @@ zend_bool s_compress_value (php_memc_compression_type compression_type, zend_str
822
822
823
823
if (compressed_size > 0 ) {
824
824
compress_status = 1 ;
825
- MEMC_VAL_SET_FLAG (* flags , MEMC_VAL_COMPRESSION_FASTLZ );
825
+ MEMC_VAL_SET_FLAG (* flags , MEMC_VAL_COMPRESSED | MEMC_VAL_COMPRESSION_FASTLZ );
826
826
}
827
827
}
828
828
break ;
@@ -834,7 +834,7 @@ zend_bool s_compress_value (php_memc_compression_type compression_type, zend_str
834
834
835
835
if (status == Z_OK ) {
836
836
compress_status = 1 ;
837
- MEMC_VAL_SET_FLAG (* flags , MEMC_VAL_COMPRESSION_ZLIB );
837
+ MEMC_VAL_SET_FLAG (* flags , MEMC_VAL_COMPRESSED | MEMC_VAL_COMPRESSION_ZLIB );
838
838
}
839
839
}
840
840
break ;
@@ -846,14 +846,14 @@ zend_bool s_compress_value (php_memc_compression_type compression_type, zend_str
846
846
847
847
if (!compress_status ) {
848
848
php_error_docref (NULL , E_WARNING , "could not compress value" );
849
- MEMC_VAL_DEL_FLAG (* flags , MEMC_VAL_COMPRESSED );
849
+ MEMC_VAL_DEL_FLAG (* flags , MEMC_VAL_COMPRESSED | MEMC_VAL_COMPRESSION_FASTLZ | MEMC_VAL_COMPRESSION_ZLIB );
850
850
efree (buffer );
851
851
return 0 ;
852
852
}
853
853
854
854
/* This means the value was too small to be compressed, still a success */
855
855
if (payload -> len < (compressed_size * MEMC_G (compression_factor ))) {
856
- MEMC_VAL_DEL_FLAG (* flags , MEMC_VAL_COMPRESSED );
856
+ MEMC_VAL_DEL_FLAG (* flags , MEMC_VAL_COMPRESSED | MEMC_VAL_COMPRESSION_FASTLZ | MEMC_VAL_COMPRESSION_ZLIB );
857
857
efree (buffer );
858
858
return 1 ;
859
859
}
@@ -1017,12 +1017,7 @@ zend_string *s_zval_to_payload(php_memc_object_t *intern, zval *value, uint32_t
1017
1017
1018
1018
/* If we have compression flag, compress the value */
1019
1019
if (should_compress ) {
1020
- /* status */
1021
- if (!s_compress_value (memc_user_data -> compression_type , & payload , flags )) {
1022
- zend_string_release (payload );
1023
- return NULL ;
1024
- }
1025
- MEMC_VAL_SET_FLAG (* flags , MEMC_VAL_COMPRESSED );
1020
+ s_compress_value (memc_user_data -> compression_type , & payload , flags );
1026
1021
}
1027
1022
1028
1023
if (memc_user_data -> set_udf_flags >= 0 ) {
0 commit comments