+#if defined(PHP_WIN32)
+# if defined(HTTP_EXPORTS)
+# define PHP_HTTP_API __declspec(dllexport)
+# elif defined(COMPILE_DL_HTTP)
+# define PHP_HTTP_API __declspec(dllimport)
+# else
+# define PHP_HTTP_API
+# endif
+#else
+# define PHP_HTTP_API
+#endif
+
+/* make functions that return SUCCESS|FAILURE more obvious */
+typedef int STATUS;
+
+/* lenof() */
+#define lenof(S) (sizeof(S) - 1)
+
+/* STR_SET() */
+#define STR_SET(target, source) \
+ if(target) efree(target); \
+ target = source
+
+/* return bool (v == SUCCESS) */
+#define RETVAL_SUCCESS(v) RETVAL_BOOL(SUCCESS == (v))
+#define RETURN_SUCCESS(v) RETURN_BOOL(SUCCESS == (v))
+/* return object(values) */
+#define RETVAL_OBJECT(o) \
+ return_value->is_ref = 1; \
+ return_value->type = IS_OBJECT; \
+ return_value->value.obj = (o)->value.obj; \
+ zval_add_ref(&return_value)
+#define RETURN_OBJECT(o) \
+ RETVAL_OBJECT(o); \
+ return
+#define RETVAL_OBJVAL(ov) \
+ return_value->is_ref = 1; \
+ return_value->type = IS_OBJECT; \
+ return_value->value.obj = (ov); \
+ zend_objects_store_add_ref(return_value TSRMLS_CC)
+#define RETURN_OBJVAL(ov) \
+ RETVAL_OBJVAL(ov); \
+ return
+
+/* function accepts no args */
+#define NO_ARGS \
+ if (ZEND_NUM_ARGS()) { \
+ zend_error(E_NOTICE, "Wrong parameter count for %s()", get_active_function_name(TSRMLS_C)); \
+ }
+
+/* check if return value is used */
+#define IF_RETVAL_USED \
+ if (!return_value_used) { \
+ return; \
+ } else