* fix some casts

* introduce unary_op_type - cleaner than casting data voids to function ptrs
This commit is contained in:
Sascha Schumann 1999-05-30 13:28:56 +00:00
parent 31da7331fe
commit 88029643d0
5 changed files with 12 additions and 11 deletions

View 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();

View 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);

View 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) {

View 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);
}
}
}

View 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;
}
}