]> granicus.if.org Git - php/commitdiff
* fix some casts
authorSascha Schumann <sas@php.net>
Sun, 30 May 1999 13:28:56 +0000 (13:28 +0000)
committerSascha Schumann <sas@php.net>
Sun, 30 May 1999 13:28:56 +0000 (13:28 +0000)
* introduce unary_op_type - cleaner than casting data voids to function ptrs

Zend/zend_alloc.c
Zend/zend_compile.h
Zend/zend_execute_API.c
Zend/zend_indent.c
Zend/zend_opcode.c

index 8f022e1325569687be87a44091e68808eb8adb9a..eec6b69daa537e96adb625f96cd6723942c9ec02 100644 (file)
@@ -114,7 +114,7 @@ ZEND_API void *_emalloc(size_t size)
        }
 
        if (!p) {
-               fprintf(stderr,"FATAL:  emalloc():  Unable to allocate %d bytes\n", size);
+               fprintf(stderr,"FATAL:  emalloc():  Unable to allocate %ld bytes\n", (long) size);
                exit(1);
                HANDLE_UNBLOCK_INTERRUPTIONS();
                return (void *)p;
@@ -218,7 +218,7 @@ ZEND_API void *_erealloc(void *ptr, size_t size)
        REMOVE_POINTER_FROM_LIST(p);
        p = (mem_header *) realloc(p,sizeof(mem_header)+size+PLATFORM_PADDING+END_ALIGNMENT(size)+END_MAGIC_SIZE);
        if (!p) {
-               fprintf(stderr,"FATAL:  erealloc():  Unable to allocate %d bytes\n", size);
+               fprintf(stderr,"FATAL:  erealloc():  Unable to allocate %ld bytes\n", (long) size);
                HANDLE_UNBLOCK_INTERRUPTIONS();
                zend_bailout();
                ADD_POINTER_TO_LIST(orig);
@@ -359,7 +359,7 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache)
                                        /* flush old leak */
                                        if (leak_count>0) {
                                                if (!silent && leak_count>1) {
-                                                       zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (leak_count-1));
+                                                       zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (long) (leak_count-1));
                                                }
                                                leak_count=0;
                                                total_bytes=0;
@@ -384,7 +384,7 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache)
        }
 #if ZEND_DEBUG
        if (!silent && leak_count>1) {
-               zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (leak_count-1));
+               zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (long) (leak_count-1));
        }
        if (had_leaks) {
                ELS_FETCH();
index a439e352feed0e6536a289379ee90ead9c76ff2f..4439d16c17068ad6eff7347fe37399c869bf9f91 100644 (file)
@@ -219,7 +219,8 @@ void fetch_array_begin(znode *result, znode *varname, znode *first_dim CLS_DC);
 void fetch_array_dim(znode *result, znode *parent, znode *dim CLS_DC);
 void do_print(znode *result, znode *arg CLS_DC);
 void do_echo(znode *arg CLS_DC);
-ZEND_API void *get_unary_op(int opcode);
+typedef int (*unary_op_type)(zval *, zval *);
+ZEND_API unary_op_type get_unary_op(int opcode);
 ZEND_API void *get_binary_op(int opcode);
 
 void do_while_cond(znode *expr, znode *close_bracket_token CLS_DC);
index fcfcd1445b33e88fffa7616ea358e1c4300df00b..d934225bfdea664e54c89748da54ab38fd95c10b 100644 (file)
@@ -306,7 +306,7 @@ int call_user_function(HashTable *function_table, zval *object, zval *function_n
                zend_ptr_stack_push(&EG(argument_stack), param);
        }
 
-       zend_ptr_stack_push(&EG(argument_stack), (void *) param_count);
+       zend_ptr_stack_push(&EG(argument_stack), (void *) (long) param_count);
 
        var_uninit(retval);
        if (function_state.function->type == ZEND_USER_FUNCTION) {
index 3c2ff597869259ffee9f27f10d89ef64549b832e..f654fd4193b44e7e779002cd1c424c4e1eefcb8b 100644 (file)
@@ -38,7 +38,7 @@ static void handle_whitespace(int *emit_whitespace)
        for (c=0; c<128; c++) {
                if (emit_whitespace[c]>0) {
                        for (i=0; i<emit_whitespace[c]; i++) {
-                               zend_write(&c, 1);
+                               zend_write((char *) &c, 1);
                        }
                }
        }
index c1b93a9251de7d26c7cc01cd9aa326d4a2b66363..56521aeda65204ada1261bdcde59e23011f45b09 100644 (file)
@@ -310,17 +310,17 @@ int print_class(zend_class_entry *class_entry)
        return 0;
 }
 
-ZEND_API void *get_unary_op(int opcode)
+ZEND_API unary_op_type get_unary_op(int opcode)
 {
        switch(opcode) {
                case ZEND_BW_NOT:
-                       return (void *) bitwise_not_function;
+                       return bitwise_not_function;
                        break;
                case ZEND_BOOL_NOT:
-                       return (void *) boolean_not_function;
+                       return boolean_not_function;
                        break;
                default:
-                       return (void *) NULL;
+                       return (unary_op_type) NULL;
                        break;
        }
 }