Skip to content

Instantly share code, notes, and snippets.

@do-aki
Created December 8, 2015 23:18
Show Gist options
  • Save do-aki/764e455ca53c35fe87ad to your computer and use it in GitHub Desktop.
Save do-aki/764e455ca53c35fe87ad to your computer and use it in GitHub Desktop.
--- php-5.6.16/ext/skeleton/skeleton.c 2015-11-26 05:28:38.000000000 +0900
+++ php-7.0.0/ext/skeleton/skeleton.c 2015-12-01 22:36:41.000000000 +0900
@@ -36,20 +36,21 @@
PHP_FUNCTION(confirm_extname_compiled)
{
char *arg = NULL;
- int arg_len, len;
- char *strg;
+ size_t arg_len, len;
+ zend_string *strg;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) {
return;
}
- len = spprintf(&strg, 0, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", arg);
- RETURN_STRINGL(strg, len, 0);
+ strg = strpprintf(0, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", arg);
+
+ RETURN_STR(strg);
}
/* }}} */
-/* The previous line is meant for vim and emacs, so it can correctly fold and
- unfold functions in source code. See the corresponding marks just before
- function definition, where the functions purpose is also documented. Please
+/* The previous line is meant for vim and emacs, so it can correctly fold and
+ unfold functions in source code. See the corresponding marks just before
+ function definition, where the functions purpose is also documented. Please
follow this convention for the convenience of others editing your code.
*/
@@ -70,7 +71,7 @@
*/
PHP_MINIT_FUNCTION(extname)
{
- /* If you have INI entries, uncomment these lines
+ /* If you have INI entries, uncomment these lines
REGISTER_INI_ENTRIES();
*/
return SUCCESS;
@@ -93,6 +94,9 @@
*/
PHP_RINIT_FUNCTION(extname)
{
+#if defined(COMPILE_DL_EXTNAME) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE();
+#endif
return SUCCESS;
}
/* }}} */
@@ -148,6 +152,9 @@
/* }}} */
#ifdef COMPILE_DL_EXTNAME
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE();
+#endif
ZEND_GET_MODULE(extname)
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment