]> granicus.if.org Git - php/commitdiff
Make this code work on compilers which don't consider the address
authorSascha Schumann <sas@php.net>
Sat, 4 May 2002 17:12:26 +0000 (17:12 +0000)
committerSascha Schumann <sas@php.net>
Sat, 4 May 2002 17:12:26 +0000 (17:12 +0000)
of a variable on the stack available at compile time.

ext/standard/file.c

index 4638fa8f0218528058ddab458d1e64853084738f..4c42dd985e87ea3ebf28c5658fce6c42008aba27 100644 (file)
@@ -588,30 +588,29 @@ static void user_space_stream_notifier(php_stream_context *context, int notifyco
 {
        zval *callback = (zval*)context->notifier->ptr;
        zval *retval = NULL;
-       zval zcode, zseverity, zmsg, zxcode, zsofar, zmax;
-       zval *ptrs[6] = {&zcode, &zseverity, &zmsg, &zxcode, &zsofar, &zmax};
-       zval **args[6] = {&ptrs[0], &ptrs[1], &ptrs[2], &ptrs[3], &ptrs[4], &ptrs[5]};
+       zval zvs[6];
+       zval *ps[6];
+       zval **ptps[6];
+       int i;
        
-       INIT_ZVAL(zcode);
-       INIT_ZVAL(zseverity);
-       INIT_ZVAL(zmsg);
-       INIT_ZVAL(zxcode);
-       INIT_ZVAL(zsofar);
-       INIT_ZVAL(zmax);
-
-       ZVAL_LONG(&zcode, notifycode);
-       ZVAL_LONG(&zseverity, severity);
-       ZVAL_LONG(&zxcode, xcode);
-       ZVAL_LONG(&zsofar, bytes_sofar);
-       ZVAL_LONG(&zmax, bytes_max);
-
+       for (i = 0; i < 6; i++) {
+               INIT_ZVAL(zvs[i]);
+               ps[i] = &zvs[i];
+               ptps[i] = &ps[i];
+       }
+               
+       ZVAL_LONG(ps[0], notifycode);
+       ZVAL_LONG(ps[1], severity);
        if (xmsg) {
-               ZVAL_STRING(&zmsg, xmsg, 0);
+               ZVAL_STRING(ps[2], xmsg, 0);
        } else {
-               ZVAL_NULL(&zmsg);
+               ZVAL_NULL(ps[2]);
        }
+       ZVAL_LONG(ps[3], xcode);
+       ZVAL_LONG(ps[4], bytes_sofar);
+       ZVAL_LONG(ps[5], bytes_max);
 
-       if (FAILURE == call_user_function_ex(EG(function_table), NULL, callback, &retval, 6, args, 0, NULL TSRMLS_CC)) {
+       if (FAILURE == call_user_function_ex(EG(function_table), NULL, callback, &retval, 6, ptps, 0, NULL TSRMLS_CC)) {
                zend_error(E_WARNING, "failed to call user notifier");
        }
        if (retval)