summaryrefslogtreecommitdiffstats
path: root/termbox-php7.patch
diff options
context:
space:
mode:
Diffstat (limited to 'termbox-php7.patch')
-rw-r--r--termbox-php7.patch145
1 files changed, 0 insertions, 145 deletions
diff --git a/termbox-php7.patch b/termbox-php7.patch
deleted file mode 100644
index 2eb0608..0000000
--- a/termbox-php7.patch
+++ /dev/null
@@ -1,145 +0,0 @@
-From 02a7c1c0a05614bd42e9d624aeda3be90d476f3a Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@php.net>
-Date: Sat, 28 Mar 2015 11:56:23 +0100
-Subject: [PATCH] PHP 7 compatibility
-
----
- php_termbox.h | 10 ++++++++++
- termbox.c | 30 +++++++++++++++++-------------
- 2 files changed, 27 insertions(+), 13 deletions(-)
-
-diff --git a/php_termbox.h b/php_termbox.h
-index 179dcd3..c21ac75 100644
---- a/php_termbox.h
-+++ b/php_termbox.h
-@@ -89,6 +89,16 @@ PHP_FUNCTION(termbox_last_error);
- #define TERMBOX_G(v) (termbox_globals.v)
- #endif
-
-+#if PHP_MAJOR_VERSION < 7
-+typedef long zend_long;
-+typedef int strsize;
-+#define TERMBOX_RETSTRL(a,l) RETURN_STRINGL(a,l,1)
-+#else
-+typedef size_t strsize;
-+#define TSRMLS_CC
-+#define TERMBOX_RETSTRL(a,l) RETURN_STRINGL(a,l)
-+#endif
-+
- #endif /* PHP_TERMBOX_H */
-
- /*
-diff --git a/termbox.c b/termbox.c
-index 0b51b0f..575b5dd 100644
---- a/termbox.c
-+++ b/termbox.c
-@@ -149,8 +149,7 @@ PHP_MINIT_FUNCTION(termbox)
- ZEND_INIT_MODULE_GLOBALS(termbox, _termbox_init_globals, NULL);
-
- /** Register constants */
-- #define PHP_TERMBOX_CONSTANT(NAME) \
-- zend_register_long_constant(#NAME, sizeof(#NAME), NAME, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
-+ #define PHP_TERMBOX_CONSTANT(NAME) REGISTER_LONG_CONSTANT(#NAME, NAME, CONST_CS | CONST_PERSISTENT);
- #include "constants.h"
- #undef PHP_TERMBOX_CONSTANT
- return SUCCESS;
-@@ -262,7 +261,8 @@ PHP_FUNCTION(termbox_clear)
- initialized yet. */
- PHP_FUNCTION(termbox_set_clear_attributes)
- {
-- long fg, bg;
-+ zend_long fg, bg;
-+
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &fg, &bg) == FAILURE) {
- return;
- }
-@@ -292,7 +292,8 @@ PHP_FUNCTION(termbox_present)
- Cursor is hidden by default. Return FALSE if not initialized yet. */
- PHP_FUNCTION(termbox_set_cursor)
- {
-- long x, y;
-+ zend_long x, y;
-+
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x, &y) == FAILURE) {
- return;
- }
-@@ -307,7 +308,8 @@ PHP_FUNCTION(termbox_set_cursor)
- position. Return FALSE if not initialized yet. */
- PHP_FUNCTION(termbox_change_cell)
- {
-- long x, y, ch, fg, bg;
-+ zend_long x, y, ch, fg, bg;
-+
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lllll", &x, &y, &ch, &fg, &bg) == FAILURE) {
- return;
- }
-@@ -322,7 +324,8 @@ PHP_FUNCTION(termbox_change_cell)
- if not yet initialized. */
- PHP_FUNCTION(termbox_set_input_mode)
- {
-- long mode;
-+ zend_long mode;
-+
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &mode) == FAILURE) {
- return;
- }
-@@ -354,7 +357,8 @@ PHP_FUNCTION(termbox_get_input_mode) {
- yet initialized. */
- PHP_FUNCTION(termbox_set_output_mode)
- {
-- long mode;
-+ zend_long mode;
-+
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &mode) == FAILURE) {
- return;
- }
-@@ -398,7 +402,7 @@ static void _termbox_event_to_php_array(struct tb_event *event, zval *event_arr)
- NULL. If an error occurrs, return FALSE. */
- PHP_FUNCTION(termbox_peek_event)
- {
-- long timeout_ms;
-+ zend_long timeout_ms;
- struct tb_event event;
- int rc;
-
-@@ -449,7 +453,7 @@ PHP_FUNCTION(termbox_poll_event)
- PHP_FUNCTION(termbox_utf8_char_to_unicode)
- {
- char *str;
-- int str_len;
-+ strsize str_len;
- uint32_t unicode_int;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
-@@ -470,7 +474,7 @@ PHP_FUNCTION(termbox_utf8_unicode_to_char)
- {
- char str[7];
- int str_len;
-- long unicode;
-+ zend_long unicode;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &unicode) == FAILURE) {
- return;
-@@ -483,7 +487,7 @@ PHP_FUNCTION(termbox_utf8_unicode_to_char)
- str_len = 0;
- }
-
-- RETURN_STRINGL(str, str_len, 1);
-+ TERMBOX_RETSTRL(str, str_len);
- }
- /* }}} */
-
-@@ -493,8 +497,8 @@ PHP_FUNCTION(termbox_utf8_unicode_to_char)
- PHP_FUNCTION(termbox_print)
- {
- char *str;
-- int str_len;
-- long x, y, fg, bg;
-+ strsize str_len;
-+ zend_long x, y, fg, bg;
- uint32_t unicode;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sllll", &str, &str_len, &x, &y, &fg, &bg) == FAILURE) {
---
-2.1.4
-