diff --git a/ext/awscrt.c b/ext/awscrt.c index ef976bc..13db16b 100644 --- a/ext/awscrt.c +++ b/ext/awscrt.c @@ -5,11 +5,11 @@ /* This is a unity-build style source file, as PHP's build system is simplest with 1 source file per extension */ +#include "crc.c" #include "credentials.c" #include "crt.c" #include "event_loop.c" +#include "hash.c" #include "http.c" #include "signing.c" #include "stream.c" -#include "hash.c" -#include "crc.c" diff --git a/ext/hash.c b/ext/hash.c index 6134903..6740370 100644 --- a/ext/hash.c +++ b/ext/hash.c @@ -22,11 +22,11 @@ PHP_FUNCTION(aws_crt_md5_new) { PHP_FUNCTION(aws_crt_hash_update) { zend_ulong php_hash = 0; - const char * buffer = NULL; + const char *buffer = NULL; size_t len = 0; aws_php_parse_parameters("ls", &php_hash, &buffer, &len); - aws_crt_hash *hash = (void *) php_hash; - RETURN_LONG((zend_ulong) aws_crt_hash_update(hash, (uint8_t *)buffer, (uint32_t) len)); + aws_crt_hash *hash = (void *)php_hash; + RETURN_LONG((zend_ulong)aws_crt_hash_update(hash, (uint8_t *)buffer, (uint32_t)len)); } PHP_FUNCTION(aws_crt_hash_digest) { @@ -34,7 +34,7 @@ PHP_FUNCTION(aws_crt_hash_digest) { size_t truncate_to = 0; size_t length = 0; aws_php_parse_parameters("lll", &php_hash, &truncate_to, &length); - aws_crt_hash *hash = (void *) php_hash; + aws_crt_hash *hash = (void *)php_hash; if (truncate_to != 0 && length > truncate_to) { length = truncate_to; } @@ -49,6 +49,6 @@ PHP_FUNCTION(aws_crt_hash_digest) { PHP_FUNCTION(aws_crt_hash_destroy) { zend_ulong php_hash = 0; aws_php_parse_parameters("l", &php_hash); - aws_crt_hash *hash = (void *) php_hash; + aws_crt_hash *hash = (void *)php_hash; aws_crt_hash_destroy(hash); } \ No newline at end of file diff --git a/ext/php_aws_crt.h b/ext/php_aws_crt.h index 60949ee..d5eb40b 100644 --- a/ext/php_aws_crt.h +++ b/ext/php_aws_crt.h @@ -64,8 +64,8 @@ ZEND_EXTERN_MODULE_GLOBALS(awscrt) } # define AWS_PHP_STREAM_FROM_ZVAL(s, z) php_stream_from_zval(s, &z) /* PHP 5.x doesn't have zend_string, so we need to shim the char* -> string zval API */ -#define ZVAL_PSTRING(z, s) ZVAL_STRING(z, s) -#define ZVAL_PSTRINGL(z, s) ZVAL_STRINGL(z, s) +# define ZVAL_PSTRING(z, s) ZVAL_STRING(z, s) +# define ZVAL_PSTRINGL(z, s) ZVAL_STRINGL(z, s) #endif /* PHP 5.x */ #include "api.h" @@ -103,29 +103,29 @@ ZEND_EXTERN_MODULE_GLOBALS(awscrt) * throws an exception resulting from argument parsing, notes the current function name in the exception */ #define aws_php_argparse_fail() \ -do { \ - aws_php_throw_exception("Failed to parse arguments to %s", __func__); \ -} while (0) + do { \ + aws_php_throw_exception("Failed to parse arguments to %s", __func__); \ + } while (0) /** * calls zend_parse_parameters() with the arguments and throws an exception if parsing fails */ #define aws_php_parse_parameters(type_spec, ...) \ -do { \ - if (zend_parse_parameters(ZEND_NUM_ARGS(), type_spec, __VA_ARGS__) == FAILURE) { \ - aws_php_argparse_fail(); \ - } \ -} while (0) + do { \ + if (zend_parse_parameters(ZEND_NUM_ARGS(), type_spec, __VA_ARGS__) == FAILURE) { \ + aws_php_argparse_fail(); \ + } \ + } while (0) /** * calls zend_parse_parameters_none() and throws an exception if parsing fails */ #define aws_php_parse_parameters_none() \ -do { \ - if (zend_parse_parameters_none() == FAILURE) { \ - aws_php_argparse_fail(); \ - } \ -} while (0) + do { \ + if (zend_parse_parameters_none() == FAILURE) { \ + aws_php_argparse_fail(); \ + } \ + } while (0) /* Thread queue functions for managing PHP's optional threading situation */ typedef struct _aws_php_task {