Permalink
Browse files

* fix some casts

* introduce unary_op_type - cleaner than casting data voids to function ptrs
  • Loading branch information...
1 parent 31da733 commit 88029643d05a4ea1f60c8856e857ea63802fb136 Sascha Schumann committed May 30, 1999
Showing with 12 additions and 11 deletions.
  1. +4 −4 Zend/zend_alloc.c
  2. +2 −1 Zend/zend_compile.h
  3. +1 −1 Zend/zend_execute_API.c
  4. +1 −1 Zend/zend_indent.c
  5. +4 −4 Zend/zend_opcode.c
View
@@ -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();
View
@@ -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);
View
@@ -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) {
View
@@ -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);
}
}
}
View
@@ -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;
}
}

0 comments on commit 8802964

Please sign in to comment.