xref: /imagick/php_imagick_macros.h (revision 41856e90)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 5 / Imagick	                                          |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar               |
6    | ImageMagick (c) ImageMagick Studio LLC                               |
7    +----------------------------------------------------------------------+
8    | This source file is subject to version 3.01 of the PHP license,      |
9    | that is bundled with this package in the file LICENSE, and is        |
10    | available through the world-wide-web at the following url:           |
11    | http://www.php.net/license/3_01.txt                                  |
12    | If you did not receive a copy of the PHP license and are unable to   |
13    | obtain it through the world-wide-web, please send a note to          |
14    | license@php.net so we can mail you a copy immediately.               |
15    +----------------------------------------------------------------------+
16    | Author: Mikko Kopppanen <mkoppanen@php.net>                          |
17    |         Scott MacVicar <scottmac@php.net>                            |
18    +----------------------------------------------------------------------+
19 */
20 
21 #ifndef PHP_IMAGICK_MACROS_H
22 # define PHP_IMAGICK_MACROS_H
23 
24 #define IMAGICK_FREE_MAGICK_MEMORY(value) \
25 	do { \
26 		if (value) { \
27 			MagickRelinquishMemory(value); \
28 			value = NULL; \
29 		} \
30 	} while (0)
31 
32 #if !defined(E_DEPRECATED)
33 #  define E_DEPRECATED E_STRICT
34 #endif
35 
36 #define IMAGICK_METHOD_DEPRECATED(class_name, method_name) \
37 	php_error(E_DEPRECATED, "%s::%s method is deprecated and it's use should be avoided", class_name, method_name);
38 
39 #define IMAGICK_METHOD_DEPRECATED_USE_INSTEAD(class_name, method_name, new_class, new_method) \
40 	php_error(E_DEPRECATED, "%s::%s is deprecated. %s::%s should be used instead", class_name, method_name, new_class, new_method);
41 
42 
43 #define IMAGICK_KERNEL_NOT_NULL_EMPTY(kernel) \
44 	if (kernel->kernel_info == NULL) { \
45 		zend_throw_exception(php_imagickkernel_exception_class_entry, "ImagickKernel is empty, cannot be used", (long)0 TSRMLS_CC); \
46 		RETURN_NULL(); \
47 	}
48 
49 #endif /* PHP_IMAGICK_MACROS_H */
50