From bab487d69d8dd907e6c5842b903c3317816b8d05 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Fri, 26 Sep 2014 11:19:00 +0100 Subject: remove fetches from gd --- ext/gd/gd_ctx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'ext/gd/gd_ctx.c') diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index 0b79cb6f0d..73f4848eeb 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -29,13 +29,11 @@ static void _php_image_output_putc(struct gdIOCtx *ctx, int c) /* {{{ */ * big endian architectures: */ unsigned char ch = (unsigned char) c; - TSRMLS_FETCH(); php_write(&ch, 1 TSRMLS_CC); } /* }}} */ static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */ { - TSRMLS_FETCH(); return php_write((void *)buf, l TSRMLS_CC); } /* }}} */ @@ -49,21 +47,19 @@ static void _php_image_output_ctxfree(struct gdIOCtx *ctx) /* {{{ */ static void _php_image_stream_putc(struct gdIOCtx *ctx, int c) /* {{{ */ { char ch = (char) c; php_stream * stream = (php_stream *)ctx->data; - TSRMLS_FETCH(); + php_stream_write(stream, &ch, 1); } /* }}} */ static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */ { php_stream * stream = (php_stream *)ctx->data; - TSRMLS_FETCH(); + return php_stream_write(stream, (void *)buf, l); } /* }}} */ static void _php_image_stream_ctxfree(struct gdIOCtx *ctx) /* {{{ */ { - TSRMLS_FETCH(); - if(ctx->data) { php_stream_close((php_stream *) ctx->data); ctx->data = NULL; -- cgit v1.2.1 From c00424e427930a33e6d8645cc3f23fb78ed29b9f Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 15 Oct 2014 09:37:55 +0200 Subject: bring back all the TSRMLS_FETCH() stuff for better comparability with the mainstream --- ext/gd/gd_ctx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ext/gd/gd_ctx.c') diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index 73f4848eeb..0b79cb6f0d 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -29,11 +29,13 @@ static void _php_image_output_putc(struct gdIOCtx *ctx, int c) /* {{{ */ * big endian architectures: */ unsigned char ch = (unsigned char) c; + TSRMLS_FETCH(); php_write(&ch, 1 TSRMLS_CC); } /* }}} */ static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */ { + TSRMLS_FETCH(); return php_write((void *)buf, l TSRMLS_CC); } /* }}} */ @@ -47,19 +49,21 @@ static void _php_image_output_ctxfree(struct gdIOCtx *ctx) /* {{{ */ static void _php_image_stream_putc(struct gdIOCtx *ctx, int c) /* {{{ */ { char ch = (char) c; php_stream * stream = (php_stream *)ctx->data; - + TSRMLS_FETCH(); php_stream_write(stream, &ch, 1); } /* }}} */ static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */ { php_stream * stream = (php_stream *)ctx->data; - + TSRMLS_FETCH(); return php_stream_write(stream, (void *)buf, l); } /* }}} */ static void _php_image_stream_ctxfree(struct gdIOCtx *ctx) /* {{{ */ { + TSRMLS_FETCH(); + if(ctx->data) { php_stream_close((php_stream *) ctx->data); ctx->data = NULL; -- cgit v1.2.1 From bdeb220f48825642f84cdbf3ff23a30613c92e86 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 13 Dec 2014 23:06:14 +0100 Subject: first shot remove TSRMLS_* things --- ext/gd/gd_ctx.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'ext/gd/gd_ctx.c') diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index 0b79cb6f0d..0d4a25b13c 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -29,14 +29,12 @@ static void _php_image_output_putc(struct gdIOCtx *ctx, int c) /* {{{ */ * big endian architectures: */ unsigned char ch = (unsigned char) c; - TSRMLS_FETCH(); - php_write(&ch, 1 TSRMLS_CC); + php_write(&ch, 1); } /* }}} */ static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */ { - TSRMLS_FETCH(); - return php_write((void *)buf, l TSRMLS_CC); + return php_write((void *)buf, l); } /* }}} */ static void _php_image_output_ctxfree(struct gdIOCtx *ctx) /* {{{ */ @@ -49,20 +47,17 @@ static void _php_image_output_ctxfree(struct gdIOCtx *ctx) /* {{{ */ static void _php_image_stream_putc(struct gdIOCtx *ctx, int c) /* {{{ */ { char ch = (char) c; php_stream * stream = (php_stream *)ctx->data; - TSRMLS_FETCH(); php_stream_write(stream, &ch, 1); } /* }}} */ static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */ { php_stream * stream = (php_stream *)ctx->data; - TSRMLS_FETCH(); return php_stream_write(stream, (void *)buf, l); } /* }}} */ static void _php_image_stream_ctxfree(struct gdIOCtx *ctx) /* {{{ */ { - TSRMLS_FETCH(); if(ctx->data) { php_stream_close((php_stream *) ctx->data); @@ -93,7 +88,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, * from imagey(). */ if (image_type == PHP_GDIMG_TYPE_XBM) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) { return; } } else { @@ -103,7 +98,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, * PHP_GDIMG_TYPE_WBM * PHP_GDIMG_TYPE_WEBP * */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z/!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z/!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) { return; } } @@ -125,7 +120,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, } } else if (Z_TYPE_P(to_zval) == IS_STRING) { if (CHECK_ZVAL_NULL_PATH(to_zval)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes"); + php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes"); RETURN_FALSE; } @@ -134,7 +129,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, RETURN_FALSE; } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 2nd parameter, it must a filename or a stream"); + php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, it must a filename or a stream"); RETURN_FALSE; } } else { @@ -161,7 +156,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, switch(image_type) { case PHP_GDIMG_CONVERT_WBM: if(q<0||q>255) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q); + php_error_docref(NULL, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q); } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, ctx, q); -- cgit v1.2.1