mirror of
https://github.com/awslabs/aws-crt-php.git
synced 2026-08-18 01:57:13 +00:00
clang-format
This commit is contained in:
+2
-2
@@ -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 */
|
/* 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 "credentials.c"
|
||||||
#include "crt.c"
|
#include "crt.c"
|
||||||
#include "event_loop.c"
|
#include "event_loop.c"
|
||||||
|
#include "hash.c"
|
||||||
#include "http.c"
|
#include "http.c"
|
||||||
#include "signing.c"
|
#include "signing.c"
|
||||||
#include "stream.c"
|
#include "stream.c"
|
||||||
#include "hash.c"
|
|
||||||
#include "crc.c"
|
|
||||||
|
|||||||
+5
-5
@@ -22,11 +22,11 @@ PHP_FUNCTION(aws_crt_md5_new) {
|
|||||||
|
|
||||||
PHP_FUNCTION(aws_crt_hash_update) {
|
PHP_FUNCTION(aws_crt_hash_update) {
|
||||||
zend_ulong php_hash = 0;
|
zend_ulong php_hash = 0;
|
||||||
const char * buffer = NULL;
|
const char *buffer = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
aws_php_parse_parameters("ls", &php_hash, &buffer, &len);
|
aws_php_parse_parameters("ls", &php_hash, &buffer, &len);
|
||||||
aws_crt_hash *hash = (void *) php_hash;
|
aws_crt_hash *hash = (void *)php_hash;
|
||||||
RETURN_LONG((zend_ulong) aws_crt_hash_update(hash, (uint8_t *)buffer, (uint32_t) len));
|
RETURN_LONG((zend_ulong)aws_crt_hash_update(hash, (uint8_t *)buffer, (uint32_t)len));
|
||||||
}
|
}
|
||||||
|
|
||||||
PHP_FUNCTION(aws_crt_hash_digest) {
|
PHP_FUNCTION(aws_crt_hash_digest) {
|
||||||
@@ -34,7 +34,7 @@ PHP_FUNCTION(aws_crt_hash_digest) {
|
|||||||
size_t truncate_to = 0;
|
size_t truncate_to = 0;
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
aws_php_parse_parameters("lll", &php_hash, &truncate_to, &length);
|
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) {
|
if (truncate_to != 0 && length > truncate_to) {
|
||||||
length = truncate_to;
|
length = truncate_to;
|
||||||
}
|
}
|
||||||
@@ -49,6 +49,6 @@ PHP_FUNCTION(aws_crt_hash_digest) {
|
|||||||
PHP_FUNCTION(aws_crt_hash_destroy) {
|
PHP_FUNCTION(aws_crt_hash_destroy) {
|
||||||
zend_ulong php_hash = 0;
|
zend_ulong php_hash = 0;
|
||||||
aws_php_parse_parameters("l", &php_hash);
|
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);
|
aws_crt_hash_destroy(hash);
|
||||||
}
|
}
|
||||||
+15
-15
@@ -64,8 +64,8 @@ ZEND_EXTERN_MODULE_GLOBALS(awscrt)
|
|||||||
}
|
}
|
||||||
# define AWS_PHP_STREAM_FROM_ZVAL(s, z) php_stream_from_zval(s, &z)
|
# 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 */
|
/* 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_PSTRING(z, s) ZVAL_STRING(z, s)
|
||||||
#define ZVAL_PSTRINGL(z, s) ZVAL_STRINGL(z, s)
|
# define ZVAL_PSTRINGL(z, s) ZVAL_STRINGL(z, s)
|
||||||
#endif /* PHP 5.x */
|
#endif /* PHP 5.x */
|
||||||
|
|
||||||
#include "api.h"
|
#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
|
* throws an exception resulting from argument parsing, notes the current function name in the exception
|
||||||
*/
|
*/
|
||||||
#define aws_php_argparse_fail() \
|
#define aws_php_argparse_fail() \
|
||||||
do { \
|
do { \
|
||||||
aws_php_throw_exception("Failed to parse arguments to %s", __func__); \
|
aws_php_throw_exception("Failed to parse arguments to %s", __func__); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calls zend_parse_parameters() with the arguments and throws an exception if parsing fails
|
* calls zend_parse_parameters() with the arguments and throws an exception if parsing fails
|
||||||
*/
|
*/
|
||||||
#define aws_php_parse_parameters(type_spec, ...) \
|
#define aws_php_parse_parameters(type_spec, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), type_spec, __VA_ARGS__) == FAILURE) { \
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), type_spec, __VA_ARGS__) == FAILURE) { \
|
||||||
aws_php_argparse_fail(); \
|
aws_php_argparse_fail(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calls zend_parse_parameters_none() and throws an exception if parsing fails
|
* calls zend_parse_parameters_none() and throws an exception if parsing fails
|
||||||
*/
|
*/
|
||||||
#define aws_php_parse_parameters_none() \
|
#define aws_php_parse_parameters_none() \
|
||||||
do { \
|
do { \
|
||||||
if (zend_parse_parameters_none() == FAILURE) { \
|
if (zend_parse_parameters_none() == FAILURE) { \
|
||||||
aws_php_argparse_fail(); \
|
aws_php_argparse_fail(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* Thread queue functions for managing PHP's optional threading situation */
|
/* Thread queue functions for managing PHP's optional threading situation */
|
||||||
typedef struct _aws_php_task {
|
typedef struct _aws_php_task {
|
||||||
|
|||||||
Reference in New Issue
Block a user