diff --git a/src/acconfig.h b/src/acconfig.h index 7176a818f81572433b69553d22126e1d3a5e7332..d38e60767bc02c2a89011d11bc29290fa7558865 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -2,7 +2,9 @@ #define MACHINE_H /* We must define this *always* */ +#ifndef POSIX_SOURCE #define POSIX_SOURCE +#endif /* Where's the master.pike file installed? */ #define DEFAULT_MASTER "@prefix@/lib/pike/master.pike" diff --git a/src/array.c b/src/array.c index 9fa73e40785ff722d26def055483ac5b89a727d1..e0838c3dc0f24f14d8a16ccb66cc817662bb987f 100644 --- a/src/array.c +++ b/src/array.c @@ -1395,7 +1395,7 @@ void check_array(struct array *a) } } -void check_all_arrays() +void check_all_arrays(void) { struct array *a; @@ -1420,7 +1420,7 @@ void gc_mark_array_as_referenced(struct array *a) gc_mark_svalues(ITEM(a), a->size); } -void gc_check_all_arrays() +void gc_check_all_arrays(void) { struct array *a; a=&empty_array; @@ -1449,7 +1449,7 @@ void gc_check_all_arrays() } -void gc_mark_all_arrays() +void gc_mark_all_arrays(void) { struct array *a; @@ -1463,7 +1463,7 @@ void gc_mark_all_arrays() } while (a != & empty_array); } -void gc_free_all_unreferenced_arrays() +void gc_free_all_unreferenced_arrays(void) { struct array *a,*next; @@ -1520,7 +1520,7 @@ void debug_dump_array(struct array *a) #endif -void zap_all_arrays() +void zap_all_arrays(void) { struct array *a,*next; diff --git a/src/array.h b/src/array.h index 70ca9c3a910476670d95bc6a792f33ce64d17c8f..96f97c20bcb97827c696e36da74e817fe5b1918d 100644 --- a/src/array.h +++ b/src/array.h @@ -123,14 +123,14 @@ void array_replace(struct array *a, struct svalue *from, struct svalue *to); void check_array(struct array *a); -void check_all_arrays(); +void check_all_arrays(void); void gc_mark_array_as_referenced(struct array *a); -void gc_check_all_arrays(); -void gc_mark_all_arrays(); -void gc_free_all_unreferenced_arrays(); +void gc_check_all_arrays(void); +void gc_mark_all_arrays(void); +void gc_free_all_unreferenced_arrays(void); void debug_dump_type_field(TYPE_FIELD t); void debug_dump_array(struct array *a); -void zap_all_arrays(); +void zap_all_arrays(void); void count_memory_in_arrays(INT32 *num_, INT32 *size_); struct array *explode_array(struct array *a, struct array *b); struct array *implode_array(struct array *a, struct array *b); diff --git a/src/backend.c b/src/backend.c index 00b30e2ab7f39253e1fa8b5d71c8870dac01ed05..f3fe6f8c31a37d5e510e41ff23c8a239e9dc3196 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: backend.c,v 1.14 1997/06/14 17:56:17 hubbe Exp $"); +RCSID("$Id: backend.c,v 1.15 1997/08/30 18:35:21 grubba Exp $"); #include "backend.h" #include <errno.h> #ifdef HAVE_SYS_TYPES_H @@ -73,7 +73,7 @@ void wake_up_backend(void) extern int pike_make_pipe(int *); -void init_backend() +void init_backend(void) { FD_ZERO(&selectors.read); FD_ZERO(&selectors.write); @@ -185,14 +185,14 @@ void *query_write_callback_data(int fd) } #ifdef DEBUG -void do_debug() +void do_debug(void) { - extern void check_all_arrays(); - extern void check_all_mappings(); - extern void check_all_programs(); - extern void check_all_objects(); - extern void verify_shared_strings_tables(); - extern void slow_check_stack(); + extern void check_all_arrays(void); + extern void check_all_mappings(void); + extern void check_all_programs(void); + extern void check_all_objects(void); + extern void verify_shared_strings_tables(void); + extern void slow_check_stack(void); slow_check_stack(); check_all_arrays(); @@ -203,7 +203,7 @@ void do_debug() } #endif -void backend() +void backend(void) { JMP_BUF back; int i, delay; @@ -297,7 +297,12 @@ void backend() if(select(max_fd+1, &sets.read, &sets.write, 0, &next_timeout) < 0 && errno == EBADF) fatal("Filedescriptor %d caused EBADF.\n",i); } +#ifdef _REENTRANT + write_to_stderr("Bad filedescriptor to select().\n" + "fd closed in another thread?\n", 62); +#else /* !_REENTRANT */ fatal("Bad filedescriptor to select().\n"); +#endif /* _REENTRANT */ } break; diff --git a/src/backend.h b/src/backend.h index f57171858860ee703d023c87663cf3a7c0647cdc..5aded4daa9bba93b8ead886c330b0ba867ea925f 100644 --- a/src/backend.h +++ b/src/backend.h @@ -20,15 +20,15 @@ struct callback *add_backend_callback(callback_func call, void *arg, callback_func free_func); void wake_up_backend(void); -void init_backend(); +void init_backend(void); void set_read_callback(int fd,file_callback cb,void *data); void set_write_callback(int fd,file_callback cb,void *data); file_callback query_read_callback(int fd); file_callback query_write_callback(int fd); void *query_read_callback_data(int fd); void *query_write_callback_data(int fd); -void do_debug(); -void backend(); +void do_debug(void); +void backend(void); int write_to_stderr(char *a, INT32 len); /* Prototypes end here */ diff --git a/src/builtin_functions.c b/src/builtin_functions.c index 8a751063bef60214ca91061c4982172c081be13f..fa428171b50e1df28ad0fc45b1eea60faff89e66 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: builtin_functions.c,v 1.40 1997/08/27 02:39:17 hubbe Exp $"); +RCSID("$Id: builtin_functions.c,v 1.41 1997/08/30 18:35:22 grubba Exp $"); #include "interpret.h" #include "svalue.h" #include "pike_macros.h" @@ -1744,7 +1744,7 @@ static void f_get_prof_info(INT32 args) } #endif /* PROFILING */ -void init_builtin_efuns() +void init_builtin_efuns(void) { init_operators(); diff --git a/src/builtin_functions.h b/src/builtin_functions.h index eb2b465b0d8efb4b3e1aa845741ea59d50ae08cf..3dbb24c7b67d62b8f2cf431ca5e297263dbbb985 100644 --- a/src/builtin_functions.h +++ b/src/builtin_functions.h @@ -74,7 +74,7 @@ struct callback *add_memory_usage_callback(callback_func call, void *arg, callback_func free_func); void f__memory_usage(INT32 args); -void init_builtin_efuns(); +void init_builtin_efuns(void); /* Prototypes end here */ #endif diff --git a/src/callback.c b/src/callback.c index 80200d268a67fb009ba306cc88b967ac138a20c5..14f52f86cfccb457faa409caf1bbcb0d6c892750 100644 --- a/src/callback.c +++ b/src/callback.c @@ -117,7 +117,7 @@ static void check_callback_chain(struct callback_list *lst) #endif /* Return the first free callback struct, allocate more if needed */ -static struct callback *get_free_callback() +static struct callback *get_free_callback(void) { struct callback *tmp; if(!free_callbacks) @@ -239,7 +239,7 @@ void free_callback(struct callback_list *lst) } } -void cleanup_callbacks() +void cleanup_callbacks(void) { while(callback_chunks) { diff --git a/src/callback.h b/src/callback.h index 43bd077232e85f33a0b7e4257efe84576d43b06d..051aaea88c89771a4ba276c718b3ea333390618d 100644 --- a/src/callback.h +++ b/src/callback.h @@ -28,7 +28,7 @@ struct callback *add_to_callback(struct callback_list *lst, callback_func free_func); void *remove_callback(struct callback *l); void free_callback(struct callback_list *lst); -void cleanup_callbacks(); +void cleanup_callbacks(void); void count_memory_in_callbacks(INT32 *num_, INT32 *size_); /* Prototypes end here */ diff --git a/src/constants.c b/src/constants.c index d960b818f78eaf6ac685a8a10491db046e083608..384327426caf9cebbcea739e016406ae50642d97 100644 --- a/src/constants.c +++ b/src/constants.c @@ -17,7 +17,7 @@ static INT32 num_callable=0; static struct mapping *builtin_constants = 0; -struct mapping *get_builtin_constants() +struct mapping *get_builtin_constants(void) { if(!builtin_constants) builtin_constants=allocate_mapping(20); @@ -113,7 +113,7 @@ void add_efun(char *name, c_fun fun, char *type, INT16 flags) add_efun2(name,fun,type,flags,0,0); } -void cleanup_added_efuns() +void cleanup_added_efuns(void) { if(builtin_constants) { diff --git a/src/constants.h b/src/constants.h index f18977e32ea902f0ec16311717eb6fb749584f4a..7e4e577e835d5f95e8c27748299218edfa6fb7b8 100644 --- a/src/constants.h +++ b/src/constants.h @@ -26,7 +26,7 @@ struct callable }; /* Prototypes begin here */ -struct mapping *get_builtin_constants(); +struct mapping *get_builtin_constants(void); void low_add_efun(struct pike_string *name, struct svalue *fun); void low_add_constant(char *name, struct svalue *fun); void add_global_program(char *name, struct program *p); @@ -44,7 +44,7 @@ void add_efun2(char *name, optimize_fun optimize, docode_fun docode); void add_efun(char *name, c_fun fun, char *type, INT16 flags); -void cleanup_added_efuns(); +void cleanup_added_efuns(void); void count_memory_in_callables(INT32 *num_, INT32 *size_); /* Prototypes end here */ diff --git a/src/docode.c b/src/docode.c index b71b086b5d5b561a70efcdaaf316659891e3f19c..cec88bc8f21fcf19b97a9eef1067de4f5248552f 100644 --- a/src/docode.c +++ b/src/docode.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: docode.c,v 1.19 1997/08/03 09:54:43 hubbe Exp $"); +RCSID("$Id: docode.c,v 1.20 1997/08/30 18:35:27 grubba Exp $"); #include "las.h" #include "program.h" #include "language.h" @@ -83,7 +83,7 @@ int store_linenumbers=1; int comp_stackp; INT32 comp_stack[COMPILER_STACK_SIZE]; -void push_address() +void push_address(void) { if (comp_stackp >= COMPILER_STACK_SIZE) { @@ -105,7 +105,7 @@ void push_explicit(INT32 address) comp_stack[comp_stackp++] = address; } -INT32 pop_address() +INT32 pop_address(void) { if (comp_stackp == 0) fatal("Compiler stack underflow.\n"); @@ -120,7 +120,7 @@ INT32 pop_address() static int label_no=0; -int alloc_label() { return ++label_no; } +int alloc_label(void) { return ++label_no; } int do_jump(int token,INT32 lbl) { diff --git a/src/docode.h b/src/docode.h index b197c0cde4dfe53f46689972342448f281a28a67..0fa3162fe513b21c110c70bd0833a885785cb74f 100644 --- a/src/docode.h +++ b/src/docode.h @@ -31,9 +31,9 @@ void ins_short(INT16 l,int area); void ins_int(INT32 l,int area); void upd_int(int offset, INT32 tmp); INT32 read_int(int offset); -void push_address(); +void push_address(void); void push_explicit(INT32 address); -INT32 pop_address(); +INT32 pop_address(void); int do_docode(node *n,INT16 flags); void do_code_block(node *n); int docode(node *n); diff --git a/src/dynamic_load.c b/src/dynamic_load.c index e9d8478ccbbf0940cffe26e6482d646f1cec3a00..f72ddae31b8f74cbf5ac04e61c73b2f225361d7b 100644 --- a/src/dynamic_load.c +++ b/src/dynamic_load.c @@ -148,7 +148,7 @@ void init_dynamic_load(void) #endif } -void exit_dynamic_load() +void exit_dynamic_load(void) { #if defined(HAVE_DLOPEN) || defined(USE_DLD) while(dynamic_module_list) diff --git a/src/dynamic_load.h b/src/dynamic_load.h index fb9ef46ea3d292de5421d861e600ab17a6592375..a83243752ffe4fa0778d9a2388935626956ddf7c 100644 --- a/src/dynamic_load.h +++ b/src/dynamic_load.h @@ -4,8 +4,8 @@ /* Prototypes begin here */ struct module_list; void f_load_module(INT32 args); -void init_dynamic_load(); -void exit_dynamic_load(); +void init_dynamic_load(void); +void exit_dynamic_load(void); /* Prototypes end here */ #endif diff --git a/src/error.c b/src/error.c index 0207417f142418659022ec22c471af42924811da..94b74888672c4c63197e1f57570fc75d46f4eb2e 100644 --- a/src/error.c +++ b/src/error.c @@ -28,7 +28,7 @@ JMP_BUF *init_recovery(JMP_BUF *r) return r; } -void throw() ATTRIBUTE((noreturn)) +void throw(void) ATTRIBUTE((noreturn)) { if(!recoveries) fatal("No error recovery context.\n"); diff --git a/src/error.h b/src/error.h index ca8837024a4e35ece3a47fe0dfe30733199e808b..7ec91722a80f7453c038c257ce83cdc6fb7e94e9 100644 --- a/src/error.h +++ b/src/error.h @@ -60,7 +60,7 @@ extern struct svalue throw_value; /* Prototypes begin here */ JMP_BUF *init_recovery(JMP_BUF *r); -void throw() ATTRIBUTE((noreturn)); +void throw(void) ATTRIBUTE((noreturn)); void va_error(char *fmt, va_list args) ATTRIBUTE((noreturn)); void exit_on_error(void *msg); void fatal_on_error(void *msg); diff --git a/src/gc.c b/src/gc.c index 1e7ae773e7e442783582b9ceccd7bb2cae16ec20..34b22df3d55f19ddb5b3e3276eb5069c31f46efb 100644 --- a/src/gc.c +++ b/src/gc.c @@ -73,7 +73,7 @@ struct marker_chunk static struct marker_chunk *chunk=0; static int markers_left_in_chunk=0; -static struct marker *new_marker() +static struct marker *new_marker(void) { if(!markers_left_in_chunk) { @@ -247,7 +247,7 @@ static INT32 hashprimes[] = 2147483647,/* ~ 2^31 = 2147483648 */ }; -void do_gc() +void do_gc(void) { static int in_gc = 0; double tmp; diff --git a/src/gc.h b/src/gc.h index 7f15fd7fe732e41aa1ab02a58a7b9aa3d878c6ab..b3289f0c12aec5e9c4de4c547850259573645d5b 100644 --- a/src/gc.h +++ b/src/gc.h @@ -38,7 +38,7 @@ int gc_is_referenced(void *a); int gc_external_mark(void *a); int gc_mark(void *a); int gc_do_free(void *a); -void do_gc(); +void do_gc(void); /* Prototypes end here */ #else diff --git a/src/hashtable.c b/src/hashtable.c index 0274aa3bc792f93933b9ff7d9568445530a9bf43..71a75ee798612ab0001e71a4a29f714b7e1cf976 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -62,7 +62,7 @@ static void rehash_list_backwards(struct hash_table *h, /* * create a new, empty hashable */ -struct hash_table *create_hash_table() +struct hash_table *create_hash_table(void) { struct hash_table *new; new=(struct hash_table *)calloc(1,sizeof(struct hash_table)+ diff --git a/src/hashtable.h b/src/hashtable.h index 3d2ad14188b135a820c442cc3042a4ca7b46638e..9afce50f70e5b112187d77422abed863e41163f1 100644 --- a/src/hashtable.h +++ b/src/hashtable.h @@ -32,7 +32,7 @@ struct hash_table /* Prototypes begin here */ struct hash_entry *hash_lookup(struct hash_table *h, struct pike_string *s); -struct hash_table *create_hash_table(); +struct hash_table *create_hash_table(void); struct hash_table *hash_rehash(struct hash_table *h,int size); struct hash_table *hash_insert(struct hash_table *h, struct hash_entry *s); struct hash_table *hash_unlink(struct hash_table *h, struct hash_entry *s); diff --git a/src/interpret.c b/src/interpret.c index 25cdaa884ae297c1c21e2b8b9a1e45d2bc9c4a8c..fa8c4eccf780b4e2aee1ba9c7e923fd022629419 100644 --- a/src/interpret.c +++ b/src/interpret.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: interpret.c,v 1.44 1997/08/03 09:55:06 hubbe Exp $"); +RCSID("$Id: interpret.c,v 1.45 1997/08/30 18:35:34 grubba Exp $"); #include "interpret.h" #include "object.h" #include "program.h" @@ -67,13 +67,13 @@ struct svalue **mark_sp; /* Current position */ struct svalue **mark_stack; /* Start of stack */ int mark_stack_malloced = 0; -void push_sp_mark() +void push_sp_mark(void) { if(mark_sp == mark_stack + stack_size) error("No more mark stack!\n"); *mark_sp++=sp; } -int pop_sp_mark() +int pop_sp_mark(void) { #ifdef DEBUG if(mark_sp < mark_stack) @@ -91,7 +91,7 @@ static void gc_check_stack_callback(struct callback *foo, void *bar, void *gazon } #endif -void init_interpreter() +void init_interpreter(void) { #ifdef USE_MMAP_FOR_STACK static int fd = -1; @@ -307,7 +307,7 @@ union anything *get_pointer_if_this_type(struct svalue *lval, TYPE_T t) } #ifdef DEBUG -void print_return_value() +void print_return_value(void) { if(t_flag>3) { @@ -357,7 +357,7 @@ struct callback_list evaluator_callbacks; /* This function is called 'every now and then'. (1-10000 / sec or so) * It should do anything that needs to be done fairly often. */ -void check_threads_etc() +void check_threads_etc(void) { call_callback(& evaluator_callbacks, (void *)0); } @@ -442,7 +442,7 @@ break /* * reset the stack machine. */ -void reset_evaluator() +void reset_evaluator(void) { fp=0; pop_n_elems(sp - evaluator_stack); @@ -1355,6 +1355,10 @@ void apply_low(struct object *o, int fun, int args) fp = &new_frame; +#ifdef PROFILING + function->num_calls++; +#endif /* PROFILING */ + if(function->func.offset == -1) error("Calling undefined function '%s'.\n",function->name->str); @@ -1599,7 +1603,6 @@ void strict_apply_svalue(struct svalue *s, INT32 args) break; case T_OBJECT: - { if(!s->u.object->prog) error("Calling a destructed object.\n"); @@ -1608,7 +1611,6 @@ void strict_apply_svalue(struct svalue *s, INT32 args) apply_lfun(s->u.object, LFUN_CALL, args); break; - } case T_INT: if (!s->u.integer) { @@ -1624,6 +1626,8 @@ void strict_apply_svalue(struct svalue *s, INT32 args) } case T_MAPPING: error("Attempt to call a mapping\n"); + case T_MULTISET: + error("Attempt to call a multiset\n"); default: error("Call to non-function value type:%d.\n", s->type); } @@ -1682,7 +1686,7 @@ void apply_svalue(struct svalue *s, INT32 args) } #ifdef DEBUG -void slow_check_stack() +void slow_check_stack(void) { struct svalue *s,**m; struct frame *f; @@ -1727,7 +1731,7 @@ void slow_check_stack() } #endif -void cleanup_interpret() +void cleanup_interpret(void) { #ifdef DEBUG int e; diff --git a/src/interpret.h b/src/interpret.h index c9a47e19c18d3db1282aabfcca60ac8d03c31cf8..4254219e4bf6b26e74c2567cf225acbb72a0748b 100644 --- a/src/interpret.h +++ b/src/interpret.h @@ -78,18 +78,18 @@ do{ \ }while(0) /* Prototypes begin here */ -void push_sp_mark(); -int pop_sp_mark(); -void init_interpreter(); +void push_sp_mark(void); +int pop_sp_mark(void); +void init_interpreter(void); void check_stack(INT32 size); void check_mark_stack(INT32 size); void lvalue_to_svalue_no_free(struct svalue *to,struct svalue *lval); void assign_lvalue(struct svalue *lval,struct svalue *from); union anything *get_pointer_if_this_type(struct svalue *lval, TYPE_T t); -void print_return_value(); +void print_return_value(void); void pop_n_elems(INT32 x); -void check_threads_etc(); -void reset_evaluator(); +void check_threads_etc(void); +void reset_evaluator(void); struct backlog; void dump_backlog(void); int apply_low_safe_and_stupid(struct object *o, INT32 offset); @@ -103,8 +103,8 @@ void apply_shared(struct object *o, void apply(struct object *o, char *fun, int args); void strict_apply_svalue(struct svalue *s, INT32 args); void apply_svalue(struct svalue *s, INT32 args); -void slow_check_stack(); -void cleanup_interpret(); +void slow_check_stack(void); +void cleanup_interpret(void); /* Prototypes end here */ extern struct svalue *sp; diff --git a/src/language.yacc b/src/language.yacc index 1b5a4cc9a74f7320f204b43b97a44ec7053ec1b5..d5199d746b7ac3384d945f5444e32ce80399dc3d 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -156,7 +156,7 @@ /* This is the grammar definition of Pike. */ #include "global.h" -RCSID("$Id: language.yacc,v 1.45 1997/08/03 12:46:15 hubbe Exp $"); +RCSID("$Id: language.yacc,v 1.46 1997/08/30 18:35:36 grubba Exp $"); #ifdef HAVE_MEMORY_H #include <memory.h> #endif @@ -182,7 +182,7 @@ RCSID("$Id: language.yacc,v 1.45 1997/08/03 12:46:15 hubbe Exp $"); #define YYDEBUG 1 #endif -void free_all_local_names(); +void free_all_local_names(void); void add_local_name(struct pike_string *,struct pike_string *); /* @@ -1424,7 +1424,7 @@ int islocal(struct pike_string *str) return -1; } -void free_all_local_names() +void free_all_local_names(void) { int e; diff --git a/src/las.c b/src/las.c index 386ec58766579cac14436088aab2d91df2f80e69..6f73e3a392ebcae659596a2c580067eb29eed1fd 100644 --- a/src/las.c +++ b/src/las.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: las.c,v 1.35 1997/08/03 09:55:09 hubbe Exp $"); +RCSID("$Id: las.c,v 1.36 1997/08/30 18:35:37 grubba Exp $"); #include "language.h" #include "interpret.h" @@ -135,7 +135,7 @@ struct node_chunk static struct node_chunk *node_chunks=0; static node *free_nodes=0; -void free_all_nodes() +void free_all_nodes(void) { if(!local_variables) { @@ -222,7 +222,7 @@ void free_node(node *n) /* here starts routines to make nodes */ -static node *mkemptynode() +static node *mkemptynode(void) { node *res; if(!free_nodes) @@ -2104,6 +2104,6 @@ int dooptcode(struct pike_string *name, return ret; } -INT32 get_opt_info() { return last_function_opt_info; } +INT32 get_opt_info(void) { return last_function_opt_info; } diff --git a/src/las.h b/src/las.h index b92cc7b2ed427fd0add9397865c376ce2dfa1ca9..46fda27e69e6ff861a7f5d64219c9c819ded4bb1 100644 --- a/src/las.h +++ b/src/las.h @@ -79,7 +79,7 @@ int car_is_node(node *n); int cdr_is_node(node *n); INT32 count_args(node *n); struct node_chunk; -void free_all_nodes(); +void free_all_nodes(void); void free_node(node *n); node *mknode(short token,node *a,node *b); node *mkstrnode(struct pike_string *str); @@ -113,7 +113,7 @@ int dooptcode(struct pike_string *name, node *n, struct pike_string *type, int modifiers); -INT32 get_opt_info(); +INT32 get_opt_info(void); /* Prototypes end here */ #define CAR(n) ((n)->u.node.a) diff --git a/src/lex.c b/src/lex.c index 3574f1cbd22f6442b1686381a2abd0fd17c66dc3..550400f13cb678bd7e2a01bb61affa1f0c7e2247 100644 --- a/src/lex.c +++ b/src/lex.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: lex.c,v 1.25 1997/07/24 02:46:51 hubbe Exp $"); +RCSID("$Id: lex.c,v 1.26 1997/08/30 18:35:39 grubba Exp $"); #include "language.h" #include "array.h" #include "lex.h" @@ -52,10 +52,10 @@ struct pike_predef_s struct pike_predef_s *pike_predefs=0; -static int calc(); -static void calc1(); +static int calc(void); +static void calc1(void); -void exit_lex() +void exit_lex(void) { #ifdef DEBUG if(p_flag) @@ -295,7 +295,7 @@ struct reserved struct hash_table *reswords; -void init_lex() +void init_lex(void) { unsigned int i; for(i=0; i<NELEM(instr_names);i++) @@ -324,7 +324,7 @@ void init_lex() reswords = hash_rehash(reswords, 2<<my_log2(NELEM(reserved_words))); } -void free_reswords() +void free_reswords(void) { free_hashtable(reswords,0); } @@ -411,9 +411,9 @@ struct inputstate INT32 pos; int dont_free_data; - int (*my_getc)(); + int (*my_getc)(void); int (*gobble)(int); - int (*look)(); + int (*look)(void); void (*my_ungetc)(int); void (*ungetstr)(char *,INT32); }; @@ -443,7 +443,7 @@ static void free_inputstate(struct inputstate *i) free((char *)i); } -static struct inputstate *new_inputstate(); +static struct inputstate *new_inputstate(void); static struct inputstate *memory_inputstate(INT32 size); static int default_gobble(int c) @@ -469,7 +469,7 @@ static void default_ungetc(int s) istate->ungetstr(&c,1); } -static int default_look() +static int default_look(void) { int c; c=istate->my_getc(); @@ -477,7 +477,7 @@ static int default_look() return c; } -static struct inputstate *new_inputstate() +static struct inputstate *new_inputstate(void) { struct inputstate *i; i=(struct inputstate *)xalloc(sizeof(struct inputstate)); @@ -493,7 +493,7 @@ static struct inputstate *new_inputstate() } /*** end of file input ***/ -static int end_getc() { return MY_EOF; } +static int end_getc(void) { return MY_EOF; } static int end_gobble(int c) { return c==MY_EOF; } static void end_ungetc(int c) { @@ -501,7 +501,7 @@ static void end_ungetc(int c) default_ungetc(c); } -static struct inputstate *end_inputstate() +static struct inputstate *end_inputstate(void) { struct inputstate *i; i=new_inputstate(); @@ -537,7 +537,7 @@ static void memory_ungetc(int s) } } -static int memory_getc() +static int memory_getc(void) { if(istate->pos<istate->buflen) { @@ -555,7 +555,7 @@ static int memory_getc() } } -static int memory_look() +static int memory_look(void) { if(istate->pos<istate->buflen) { @@ -630,7 +630,7 @@ static struct inputstate *prot_memory_inputstate(char *data,INT32 len) /*** FILE input ***/ #define READAHEAD 8192 -static int file_getc() +static int file_getc(void) { unsigned char buf[READAHEAD]; int got; @@ -665,7 +665,7 @@ static struct inputstate *file_inputstate(int fd) return i; } -static int GETC() +static int GETC(void) { int c; c=istate->my_getc(); @@ -720,7 +720,7 @@ static char buf[1024]; struct define { struct hash_entry link; /* must be first */ - void (*magic)(); + void (*magic)(void); int args; struct array *parts; }; @@ -748,7 +748,7 @@ static void undefine(struct pike_string *name) static void add_define(struct pike_string *name, int args, int parts_on_stack, - void (*magic)()) + void (*magic)(void)) { struct define *d; @@ -783,7 +783,7 @@ static void add_define(struct pike_string *name, defines=hash_insert(defines, & d->link); } -static void simple_add_define(char *name,char *as,void (*magic)()) +static void simple_add_define(char *name,char *as,void (*magic)(void)) { if(magic) { @@ -802,14 +802,14 @@ void free_one_define(struct hash_entry *h) free((void *)d); } -static void free_all_defines() +static void free_all_defines(void) { if(defines) free_hashtable(defines, free_one_define); defines=0; } -static void do_define() +static void do_define(void) { int c,e,t,argc; struct svalue *save_sp=sp; @@ -1067,7 +1067,7 @@ static void handle_include(char *name, int local_include) /*** Lexical analyzing ***/ -static int char_const() +static int char_const(void) { int c; switch(c=GETC()) @@ -1771,7 +1771,7 @@ int yylex(YYSTYPE *yylval) static YYSTYPE my_yylval; static int lookahead; -static void low_lex() +static void low_lex(void) { while(1) { @@ -1838,7 +1838,7 @@ static void low_lex() } } -static void calcC() +static void calcC(void) { switch(lookahead) { @@ -1881,7 +1881,7 @@ static void calcC() } } -static void calcB() +static void calcB(void) { switch(lookahead) { @@ -1892,7 +1892,7 @@ static void calcB() } } -static void calcA() +static void calcA(void) { calcB(); while(1) @@ -1907,7 +1907,7 @@ static void calcA() } } -static void calc9() +static void calc9(void) { calcA(); @@ -1922,7 +1922,7 @@ static void calc9() } } -static void calc8() +static void calc8(void) { calc9(); @@ -1937,7 +1937,7 @@ static void calc8() } } -static void calc7b() +static void calc7b(void) { calc8(); @@ -1954,7 +1954,7 @@ static void calc7b() } } -static void calc7() +static void calc7(void) { calc7b(); @@ -1969,7 +1969,7 @@ static void calc7() } } -static void calc6() +static void calc6(void) { calc7(); @@ -1981,7 +1981,7 @@ static void calc6() } } -static void calc5() +static void calc5(void) { calc6(); @@ -1993,7 +1993,7 @@ static void calc5() } } -static void calc4() +static void calc4(void) { calc5(); @@ -2005,7 +2005,7 @@ static void calc4() } } -static void calc3() +static void calc3(void) { calc4(); @@ -2024,7 +2024,7 @@ static void calc3() } } -static void calc2() +static void calc2(void) { calc3(); @@ -2043,7 +2043,7 @@ static void calc2() } } -static void calc1() +static void calc1(void) { calc2(); @@ -2063,7 +2063,7 @@ static void calc1() } -static int calc() +static int calc(void) { JMP_BUF recovery; int ret; @@ -2105,21 +2105,21 @@ static int calc() } /*** Magic defines ***/ -void insert_current_line() +void insert_current_line(void) { char buf[20]; sprintf(buf," %ld ",(long)current_line); UNGETSTR(buf,strlen(buf)); } -void insert_current_file_as_string() +void insert_current_file_as_string(void) { UNGETSTR("\"",1); UNGETSTR(current_file->str, current_file->len); UNGETSTR("\"",1); } -void insert_current_time_as_string() +void insert_current_time_as_string(void) { time_t tmp; char *buf; @@ -2131,7 +2131,7 @@ void insert_current_time_as_string() UNGETSTR("\"",1); } -void insert_current_date_as_string() +void insert_current_date_as_string(void) { time_t tmp; char *buf; @@ -2146,7 +2146,7 @@ void insert_current_date_as_string() /*** ***/ -static void start_new() +static void start_new(void) { struct pike_predef_s *tmpf; @@ -2189,7 +2189,7 @@ void start_new_string(char *s,INT32 len,struct pike_string *name) UNGETSTR("\n",1); } -void end_new_file() +void end_new_file(void) { if(current_file) { diff --git a/src/lex.h b/src/lex.h index e5d0f5ba7649e8436dce6e286e7e02d75ee85454..e74f2a789f32bcfa08a938549e81955695af3ff1 100644 --- a/src/lex.h +++ b/src/lex.h @@ -68,23 +68,23 @@ extern struct pike_predef_s * pike_predefs; /* Prototypes begin here */ struct pike_predef_s; -void exit_lex(); +void exit_lex(void); struct reserved; -void init_lex(); -void free_reswords(); +void init_lex(void); +void free_reswords(void); char *low_get_f_name(int n,struct program *p); char *get_f_name(int n); char *get_token_name(int n); struct inputstate; struct define; void free_one_define(struct hash_entry *h); -void insert_current_line(); -void insert_current_file_as_string(); -void insert_current_time_as_string(); -void insert_current_date_as_string(); +void insert_current_line(void); +void insert_current_file_as_string(void); +void insert_current_time_as_string(void); +void insert_current_date_as_string(void); void start_new_file(int fd,struct pike_string *filename); void start_new_string(char *s,INT32 len,struct pike_string *name); -void end_new_file(); +void end_new_file(void); void add_predefine(char *s); /* Prototypes end here */ diff --git a/src/main.c b/src/main.c index 8379bf57e93ac01b8cbfde91c6191618101ee1a3..07cf2ebd4ac53f5d8b35f3285098220742b69078 100644 --- a/src/main.c +++ b/src/main.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: main.c,v 1.22 1997/05/19 22:48:07 hubbe Exp $"); +RCSID("$Id: main.c,v 1.23 1997/08/30 18:35:41 grubba Exp $"); #include "backend.h" #include "module.h" #include "object.h" @@ -266,9 +266,9 @@ void init_main(void) void exit_main(void) { - void cleanup_added_efuns(); - void cleanup_pike_types(); - void cleanup_program(); + void cleanup_added_efuns(void); + void cleanup_pike_types(void); + void cleanup_program(void); th_cleanup(); cleanup_objects(); diff --git a/src/mapping.c b/src/mapping.c index 6be1344b8105cc9f2447a959834e7c00f347de4f..5bddebba736b68b74517d6ba19be36a99d054b04 100644 --- a/src/mapping.c +++ b/src/mapping.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: mapping.c,v 1.20 1997/05/19 23:31:02 hubbe Exp $"); +RCSID("$Id: mapping.c,v 1.21 1997/08/30 18:35:42 grubba Exp $"); #include "main.h" #include "object.h" #include "mapping.h" @@ -939,7 +939,7 @@ void check_mapping(struct mapping *m) } -void check_all_mappings() +void check_all_mappings(void) { struct mapping *m; for(m=first_mapping;m;m=m->next) @@ -975,7 +975,7 @@ void gc_mark_mapping_as_referenced(struct mapping *m) } } -void gc_check_all_mappings() +void gc_check_all_mappings(void) { INT32 e; struct keypair *k; @@ -1006,7 +1006,7 @@ void gc_check_all_mappings() } } -void gc_mark_all_mappings() +void gc_mark_all_mappings(void) { struct mapping *m; for(m=first_mapping;m;m=m->next) @@ -1014,7 +1014,7 @@ void gc_mark_all_mappings() gc_mark_mapping_as_referenced(m); } -void gc_free_all_unreferenced_mappings() +void gc_free_all_unreferenced_mappings(void) { INT32 e; struct keypair *k; @@ -1059,7 +1059,7 @@ void gc_free_all_unreferenced_mappings() #endif /* GC2 */ -void zap_all_mappings() +void zap_all_mappings(void) { INT32 e; struct keypair *k; diff --git a/src/mapping.h b/src/mapping.h index 558e460aa40af40640d43017e17fe4aa42af63ca..5d7fce75bace51fd3baf29e6c0ee8a82e1b23ecd 100644 --- a/src/mapping.h +++ b/src/mapping.h @@ -63,12 +63,12 @@ void mapping_search_no_free(struct svalue *to, struct svalue *look_for, struct svalue *start); void check_mapping(struct mapping *m); -void check_all_mappings(); +void check_all_mappings(void); void gc_mark_mapping_as_referenced(struct mapping *m); -void gc_check_all_mappings(); -void gc_mark_all_mappings(); -void gc_free_all_unreferenced_mappings(); -void zap_all_mappings(); +void gc_check_all_mappings(void); +void gc_mark_all_mappings(void); +void gc_free_all_unreferenced_mappings(void); +void zap_all_mappings(void); void count_memory_in_mappings(INT32 *num_, INT32 *size_); /* Prototypes end here */ #endif diff --git a/src/modules/Gdbm/gdbmmod.c b/src/modules/Gdbm/gdbmmod.c index 7a5e2a7a808c253e0ab77a500794061b4f1ee34a..6b4777863ead24e6725609f2dbd39f413e129741 100644 --- a/src/modules/Gdbm/gdbmmod.c +++ b/src/modules/Gdbm/gdbmmod.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: gdbmmod.c,v 1.3 1997/05/19 22:48:34 hubbe Exp $"); +RCSID("$Id: gdbmmod.c,v 1.4 1997/08/30 18:36:04 grubba Exp $"); #include "gdbm_machine.h" #include "threads.h" @@ -32,7 +32,7 @@ struct gdbm_glue #define THIS ((struct gdbm_glue *)(fp->current_storage)) -static void do_free() +static void do_free(void) { if(THIS->dbf) { diff --git a/src/modules/Gmp/mpz_glue.c b/src/modules/Gmp/mpz_glue.c index cd307cd2bcff6208a9bc4cc441ba7891d6f16464..ed5ade28f11cd3ab998d2601e2daab0cb87780dd 100644 --- a/src/modules/Gmp/mpz_glue.c +++ b/src/modules/Gmp/mpz_glue.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: mpz_glue.c,v 1.19 1997/06/04 16:02:02 nisse Exp $"); +RCSID("$Id: mpz_glue.c,v 1.20 1997/08/30 18:36:06 grubba Exp $"); #include "gmp_machine.h" #if !defined(HAVE_LIBGMP) @@ -335,7 +335,7 @@ static MP_INT *get_mpz(struct svalue *s, int throw_error) * case of errors.. */ static struct object *temporary; -MP_INT *get_tmp() +MP_INT *get_tmp(void) { if(!temporary) temporary=clone_object(mpzmod_program,0); diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c index 0e6d7a8edca6fd806acf87cb5facd283e07fb3dd..77adad53e1837f2a0bb0328a1df916cfbaa72f01 100644 --- a/src/modules/Image/image.c +++ b/src/modules/Image/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.35 1997/05/30 00:21:12 mirar Exp $ */ +/* $Id: image.c,v 1.36 1997/08/30 18:36:07 grubba Exp $ */ /* **! module Image @@ -6,7 +6,7 @@ **! This module adds image-drawing and -manipulating **! capabilities to pike. **! note -**! $Id: image.c,v 1.35 1997/05/30 00:21:12 mirar Exp $<br> +**! $Id: image.c,v 1.36 1997/08/30 18:36:07 grubba Exp $<br> **! see also: Image.font, Image.image **! **! class image @@ -107,7 +107,7 @@ #include "stralloc.h" #include "global.h" -RCSID("$Id: image.c,v 1.35 1997/05/30 00:21:12 mirar Exp $"); +RCSID("$Id: image.c,v 1.36 1997/08/30 18:36:07 grubba Exp $"); #include "pike_macros.h" #include "object.h" #include "constants.h" @@ -2662,7 +2662,7 @@ void image_select_colors(INT32 args) void init_font_programs(void); void exit_font(void); -void pike_module_init() +void pike_module_init(void) { int i; diff --git a/src/modules/Image/polyfill.c b/src/modules/Image/polyfill.c index 9710aa9c95c89b1c39df8da9b7f8684600dd2d48..b91a2b08cab865ec6b1f11f9f85ee6b5de917b8d 100644 --- a/src/modules/Image/polyfill.c +++ b/src/modules/Image/polyfill.c @@ -1,5 +1,8 @@ #include "global.h" +/* Prototypes are needed for these */ +extern double floor(double); + #include <unistd.h> #include <math.h> @@ -25,7 +28,7 @@ /* **! module Image **! note -**! $Id: polyfill.c,v 1.4 1997/05/29 19:38:09 mirar Exp $<br> +**! $Id: polyfill.c,v 1.5 1997/08/30 18:36:09 grubba Exp $<br> **! class image */ @@ -578,7 +581,7 @@ static INLINE void polygone_free(struct vertex *top) } } -static INLINE struct vertex *polygone_begin() +static INLINE struct vertex *polygone_begin(void) { return NULL; } diff --git a/src/modules/Mysql/mysql.c b/src/modules/Mysql/mysql.c index 643d553997194f5d49dea0446bed6dce45e021be..340ce890a1614e1849f117c3d419d632736a462d 100644 --- a/src/modules/Mysql/mysql.c +++ b/src/modules/Mysql/mysql.c @@ -1,5 +1,5 @@ /* - * $Id: mysql.c,v 1.5 1997/06/30 20:00:05 grubba Exp $ + * $Id: mysql.c,v 1.6 1997/08/30 18:36:10 grubba Exp $ * * SQL database functionality for Pike * @@ -73,7 +73,7 @@ typedef struct dynamic_buffer_s dynamic_buffer; * Globals */ -RCSID("$Id: mysql.c,v 1.5 1997/06/30 20:00:05 grubba Exp $"); +RCSID("$Id: mysql.c,v 1.6 1997/08/30 18:36:10 grubba Exp $"); struct program *mysql_program = NULL; @@ -128,7 +128,7 @@ static void exit_mysql_struct(struct object *o) } -static void pike_mysql_reconnect() +static void pike_mysql_reconnect(void) { MYSQL *mysql = &(PIKE_MYSQL->mysql); MYSQL *socket; diff --git a/src/modules/Pipe/pipe.c b/src/modules/Pipe/pipe.c index 9c449575e38b2f4a59bb5e8dc39b2c1ac0e4f8b0..2bc75551c6de53103cef81023f4846caa7a8d4c4 100644 --- a/src/modules/Pipe/pipe.c +++ b/src/modules/Pipe/pipe.c @@ -22,7 +22,7 @@ #include <fcntl.h> #include "global.h" -RCSID("$Id: pipe.c,v 1.10 1997/08/29 17:54:05 marcus Exp $"); +RCSID("$Id: pipe.c,v 1.11 1997/08/30 18:36:11 grubba Exp $"); #include "stralloc.h" #include "pike_macros.h" @@ -290,7 +290,7 @@ static INLINE int append_buffer(struct pike_string *s) } /* Wake up the sleepers */ -static void low_start() +static void low_start(void) { struct object *obj, *next; struct output *o; @@ -1106,7 +1106,7 @@ void f__pipe_debug(INT32 args) f_aggregate(7); } -void pike_module_init() +void pike_module_init(void) { start_new_program(); add_storage(sizeof(struct pipe)); diff --git a/src/modules/Regexp/glue.c b/src/modules/Regexp/glue.c index b1ecb995d05c933889a4f7315f13ddc9fcf64b96..837fdf99aa1623f215e9ca4a84fbe5d42dac3f6a 100644 --- a/src/modules/Regexp/glue.c +++ b/src/modules/Regexp/glue.c @@ -39,7 +39,7 @@ struct regexp_glue #define THIS ((struct regexp_glue *)(fp->current_storage)) -static void do_free() +static void do_free(void) { if(THIS->regexp) { diff --git a/src/modules/Regexp/pike_regexp.c b/src/modules/Regexp/pike_regexp.c index 6bb86144e6128672c0128236a832a5eed6939749..531ec8ed4a48ff2ebd07b79e244df248f04921b0 100644 --- a/src/modules/Regexp/pike_regexp.c +++ b/src/modules/Regexp/pike_regexp.c @@ -216,16 +216,16 @@ static long regsize; /* Code size. */ #ifndef STATIC #define STATIC static #endif -STATIC char *reg(); -STATIC char *regbranch(); -STATIC char *regpiece(); -STATIC char *regatom(); -STATIC char *regnode(); -STATIC char *regnext(); -STATIC void regc(); -STATIC void reginsert(); -STATIC void regtail(); -STATIC void regoptail(); +STATIC char *reg(int, int *); +STATIC char *regbranch(int *); +STATIC char *regpiece(int *); +STATIC char *regatom(int *); +STATIC char *regnode(char); +STATIC char *regnext(register char *); +STATIC void regc(char b); +STATIC void reginsert(char, char *); +STATIC void regtail(char *, char *); +STATIC void regoptail(char *, char *); /* - regcomp - compile a regular expression into internal code @@ -769,14 +769,14 @@ static char **regendp; /* Ditto for endp. */ /* * Forwards. */ -STATIC int regtry(); -STATIC int regmatch(); -STATIC int regrepeat(); +STATIC int regtry(regexp *, char *); +STATIC int regmatch(char *); +STATIC int regrepeat(char *); #ifdef DEBUG int regnarrate = 0; -void regdump(); -STATIC char *regprop(); +void regdump(regexp *); +STATIC char *regprop(char *op); #endif /* @@ -1170,7 +1170,7 @@ register char *p; #ifdef DEBUG -STATIC char *regprop(); +STATIC char *regprop(char *); /* - regdump - dump a regexp onto stdout in vaguely comprehensible form diff --git a/src/modules/Ssleay/ssleay.c b/src/modules/Ssleay/ssleay.c index 6d7690824fff1e10e80a01853fc5764f361b01db..5720005e982dabfff54f9acbe0d8f18ad78f5923 100644 --- a/src/modules/Ssleay/ssleay.c +++ b/src/modules/Ssleay/ssleay.c @@ -7,7 +7,7 @@ #include "config.h" #include "global.h" -RCSID("$Id: ssleay.c,v 1.6 1997/05/30 01:12:30 grubba Exp $"); +RCSID("$Id: ssleay.c,v 1.7 1997/08/30 18:36:14 grubba Exp $"); #include "interpret.h" #include "svalue.h" #include "stralloc.h" @@ -226,7 +226,7 @@ static unsigned long ssleay_thread_id(void) return (unsigned long)th_self(); } -static void ssleay_init_threads() +static void ssleay_init_threads(void) { int i; for (i = 0; i<CRYPTO_NUM_LOCKS; i++) @@ -261,7 +261,7 @@ void exit_connection(struct object *o) #endif /* HAVE_SSLEAY */ -void pike_module_exit() +void pike_module_exit(void) { #ifdef HAVE_SSLEAY free_program(ssleay_connection_program); diff --git a/src/modules/Yp/yp.c b/src/modules/Yp/yp.c index 163afc9212dc8856e54d18bc953341a068f6ceaf..e8cee427dc7125b9767069c156c754f736e62f1a 100644 --- a/src/modules/Yp/yp.c +++ b/src/modules/Yp/yp.c @@ -143,7 +143,7 @@ void f_map(INT32 args) static void f_order(INT32 args) { int err; - unsigned long ret; + unsigned int ret; check_all_args("yp->order", args, BIT_STRING, 0); err = yp_order( this->domain, sp[-args].u.string->str, &ret); diff --git a/src/modules/_Crypto/lib/desQuick.c b/src/modules/_Crypto/lib/desQuick.c index d219948e121a0756d52b3ed31b8c914be797ac36..521d28d37b6c9336ad8079630d64a8700c87e254 100644 --- a/src/modules/_Crypto/lib/desQuick.c +++ b/src/modules/_Crypto/lib/desQuick.c @@ -9,7 +9,7 @@ #include "des.h" #include "RCSID.h" -RCSID2(desQuick_cRcs, "$Id: desQuick.c,v 1.2 1997/03/15 04:51:51 nisse Exp $"); +RCSID2(desQuick_cRcs, "$Id: desQuick.c,v 1.3 1997/08/30 18:36:18 grubba Exp $"); extern unsigned INT32 des_keymap[]; @@ -22,7 +22,7 @@ unsigned INT32 des_bigmap[0x4000]; /* big lookup table */ /* fill in the 64k table used by the `quick' option */ void -DesQuickInit() +DesQuickInit(void) { int s1, s3, x; unsigned INT32 * t0, * t1, * t2, * t3; @@ -49,6 +49,6 @@ DesQuickInit() /* free the 64k table, if necessary */ void -DesQuickDone() +DesQuickDone(void) { } diff --git a/src/modules/call_out/call_out.c b/src/modules/call_out/call_out.c index 74fc1a8cdbe1493c27e460ba6c9ab3558cd2725a..26526b881cd0a5650bab922402874254ef04bfd4 100644 --- a/src/modules/call_out/call_out.c +++ b/src/modules/call_out/call_out.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: call_out.c,v 1.12 1997/05/19 23:32:56 hubbe Exp $"); +RCSID("$Id: call_out.c,v 1.13 1997/08/30 18:36:19 grubba Exp $"); #include "array.h" #include "dynamic_buffer.h" #include "object.h" @@ -50,7 +50,7 @@ static int call_buffer_size; /* no of pointers in buffer */ #define CMP(X,Y) my_timercmp(& CALL(X).tv, <, & CALL(Y).tv) #define SWAP(X,Y) do{ call_out _tmp=CALL(X); CALL(X)=CALL(Y); CALL(Y)=_tmp; } while(0) -static void verify_call_outs() +static void verify_call_outs(void) { #ifdef DEBUG struct array *v; @@ -382,7 +382,7 @@ void f_remove_call_out(INT32 args) /* return an array containing info about all call outs: * ({ ({ delay, caller, function, args, ... }), ... }) */ -struct array *get_all_call_outs() +struct array *get_all_call_outs(void) { int e; struct array *ret; @@ -422,7 +422,7 @@ void f_call_out_info(INT32 args) push_array(get_all_call_outs()); } -void free_all_call_outs() +void free_all_call_outs(void) { int e; verify_call_outs(); @@ -437,7 +437,7 @@ void free_all_call_outs() } #ifdef DEBUG -void verify_all_call_outs() +void verify_all_call_outs(void) { verify_call_outs(); } diff --git a/src/modules/files/efuns.c b/src/modules/files/efuns.c index 6f2583a7c785df0ad12aed1b6a3d8e02155b6dd6..72b9456867ff742332dbd874fc7abd5a696baa0d 100644 --- a/src/modules/files/efuns.c +++ b/src/modules/files/efuns.c @@ -660,7 +660,7 @@ void f_errno(INT32 args) push_int(errno); } -void init_files_efuns() +void init_files_efuns(void) { set_close_on_exec(0,1); set_close_on_exec(1,1); diff --git a/src/modules/files/file.c b/src/modules/files/file.c index 416e53037bbbc3a16b52ccb6cf99037b484d0819..91be4325bc49790a53aea67c493dd9cff98c193c 100644 --- a/src/modules/files/file.c +++ b/src/modules/files/file.c @@ -6,7 +6,7 @@ #define READ_BUFFER 8192 #include "global.h" -RCSID("$Id: file.c,v 1.50 1997/08/15 20:20:53 grubba Exp $"); +RCSID("$Id: file.c,v 1.51 1997/08/30 18:36:21 grubba Exp $"); #include "interpret.h" #include "svalue.h" #include "stralloc.h" @@ -179,7 +179,7 @@ void my_set_close_on_exec(int fd, int to) } } -void do_set_close_on_exec() +void do_set_close_on_exec(void) { int e; for(e=0;e<MAX_OPEN_FILEDESCRIPTORS;e++) @@ -1447,7 +1447,7 @@ static void file_create(INT32 args) } } -void pike_module_exit() +void pike_module_exit(void) { if(file_program) { @@ -1499,7 +1499,7 @@ void mark_ids(struct callback *foo, void *bar, void *gazonk) void init_files_efuns(void); -void pike_module_init() +void pike_module_init(void) { extern void port_setup_program(void); int e; diff --git a/src/modules/files/file.h b/src/modules/files/file.h index 37e6cbbed096739ce769f3a88caec8a00ec7c773..e1856e6881406eb6f77a115847350e00dcc98557 100644 --- a/src/modules/files/file.h +++ b/src/modules/files/file.h @@ -38,12 +38,12 @@ extern void get_inet_addr(struct sockaddr_in *addr,char *name); /* Prototypes begin here */ struct file_struct; void my_set_close_on_exec(int fd, int to); -void do_set_close_on_exec(); +void do_set_close_on_exec(void); struct object *file_make_object_from_fd(int fd, int mode); int socketpair(int family, int type, int protocol, int sv[2]); -void exit_files(); +void exit_files(void); void mark_ids(struct callback *foo, void *bar, void *gazonk); -void init_files_programs(); +void init_files_programs(void); /* Prototypes end here */ #define FILE_READ 1 diff --git a/src/modules/files/socket.c b/src/modules/files/socket.c index a75e869a937f7056e6cc51e428951c7a2dedb52c..214bcf8c4e9148d8d718eccf907443d721a51b1a 100644 --- a/src/modules/files/socket.c +++ b/src/modules/files/socket.c @@ -367,7 +367,7 @@ static void exit_port_struct(struct object *o) THIS->accept_callback.type=T_INT; } -void port_setup_program() +void port_setup_program(void) { INT32 offset; start_new_program(); diff --git a/src/modules/math/math.c b/src/modules/math/math.c index d9b21d125dcf4b6e57f27b5e916499a3bc5c2659..fb9eda31d28f3c5dabf87d9a37fe88baee54747e 100644 --- a/src/modules/math/math.c +++ b/src/modules/math/math.c @@ -138,7 +138,7 @@ void f_ceil(INT32 args) } -void pike_module_init() +void pike_module_init(void) { add_efun("sin",f_sin,"function(float:float)",0); add_efun("asin",f_asin,"function(float:float)",0); @@ -154,4 +154,4 @@ void pike_module_init() add_efun("ceil",f_ceil,"function(float:float)",0); } -void pike_module_exit() {} +void pike_module_exit(void) {} diff --git a/src/modules/spider/accesseddb.c b/src/modules/spider/accesseddb.c index 2b081f63f66fe145793a9eb70a970a8bdc25e30a..35a4b5068b0d540932bbcd7b8f334d7cef484099 100644 --- a/src/modules/spider/accesseddb.c +++ b/src/modules/spider/accesseddb.c @@ -301,7 +301,8 @@ static struct string *make_string(struct svalue *s) res = malloc(sizeof(struct string) + s->u.string->len-1); res->len = s->u.string->len; MEMCPY(res->s, s->u.string->str, res->len); - res->hval = hashmem(res->s, (INT32)res->len, (INT32)res->len); + res->hval = hashmem((unsigned char *)res->s, (INT32)res->len, + (INT32)res->len); return res; } @@ -517,6 +518,6 @@ void init_accessdb_program(void) end_class("accessdb",0); } -void exit_accessdb_program() +void exit_accessdb_program(void) { } diff --git a/src/modules/spider/dumudp.c b/src/modules/spider/dumudp.c index b3280978dc61466f01907f63965c300969691f17..89461ff1a4a90f83265faaff4d68bc75f5037c64 100644 --- a/src/modules/spider/dumudp.c +++ b/src/modules/spider/dumudp.c @@ -1,7 +1,7 @@ #include <config.h> #include "global.h" -RCSID("$Id: dumudp.c,v 1.13 1997/08/26 23:09:54 grubba Exp $"); +RCSID("$Id: dumudp.c,v 1.14 1997/08/30 18:36:25 grubba Exp $"); #include "interpret.h" #include "svalue.h" #include "stralloc.h" @@ -244,12 +244,12 @@ void udp_sendto(INT32 args) } -void zero_udp() +void zero_udp(struct object *ignored) { MEMSET(THIS, 0, sizeof(struct dumudp)); } -void exit_udp() +void exit_udp(struct object *ignored) { if(THIS->fd) { @@ -303,7 +303,7 @@ static void udp_set_nonblocking(INT32 args) set_nonblocking(FD,1); } -void init_udp() +void init_udp(void) { start_new_program(); @@ -321,3 +321,4 @@ void init_udp() /* otherwise... */ end_class("dumUDP",0); } + diff --git a/src/modules/spider/spider.c b/src/modules/spider/spider.c index 0f386937f9eb8bbb8346b60873530279a94bba10..c1ecde9e41040771e95a77f86c5f7119397fb4d8 100644 --- a/src/modules/spider/spider.c +++ b/src/modules/spider/spider.c @@ -1245,7 +1245,7 @@ void f_name_process(INT32 args) static struct program *streamed_parser; -extern void init_udp(); +extern void init_udp(void); void pike_module_init(void) { diff --git a/src/modules/spider/streamed_parser.c b/src/modules/spider/streamed_parser.c index 1f7bc06854a2082553ce4456f47ab1049ff8fd49..d4ce7aa47af3068518f55d16baaeb0d07671c445 100644 --- a/src/modules/spider/streamed_parser.c +++ b/src/modules/spider/streamed_parser.c @@ -139,7 +139,7 @@ content_skip_fnutt ' content_skip #define DATA ((struct streamed_parser *)(fp->current_storage)) -void streamed_parser_init() +void streamed_parser_init(void) { DATA->last_buffer = 0; DATA->last_buffer_size = 0; @@ -148,7 +148,7 @@ void streamed_parser_init() DATA->end_tags = 0; } -void streamed_parser_destruct() +void streamed_parser_destruct(void) { if (DATA->last_buffer) free( DATA->last_buffer ); @@ -237,7 +237,7 @@ static int handle_end_tag( struct svalue *data_arg ) return 0; } -static void add_arg() +static void add_arg(void) { mapping_insert( sp[-3].u.mapping, sp-2, sp-1 ); pop_stack(); diff --git a/src/modules/spider/streamed_parser.h b/src/modules/spider/streamed_parser.h index 720c62e54d0a1e4a00c40365a4a268afcdadb6ad..de04daa6af7112a65a17ddbf2a670f346b01c4e7 100644 --- a/src/modules/spider/streamed_parser.h +++ b/src/modules/spider/streamed_parser.h @@ -11,8 +11,8 @@ struct streamed_parser struct svalue *digest; }; -void streamed_parser_init(); -void streamed_parser_destruct(); +void streamed_parser_init(void); +void streamed_parser_destruct(void); void streamed_parser_set_data( INT32 args ); void streamed_parser_parse( INT32 args ); void streamed_parser_finish( INT32 args ); diff --git a/src/multiset.c b/src/multiset.c index fcc31acb2f94ea22adbb8189d4ff67e5e6f565ff..7e595ca723b32f033bb6ab98a92381cbabb416c2 100644 --- a/src/multiset.c +++ b/src/multiset.c @@ -271,14 +271,14 @@ void gc_mark_multiset_as_referenced(struct multiset *l) gc_mark_array_as_referenced(l->ind); } -void gc_check_all_multisets() +void gc_check_all_multisets(void) { struct multiset *l; for(l=first_multiset;l;l=l->next) gc_check(l->ind); } -void gc_mark_all_multisets() +void gc_mark_all_multisets(void) { struct multiset *l; for(l=first_multiset;l;l=l->next) @@ -286,7 +286,7 @@ void gc_mark_all_multisets() gc_mark_multiset_as_referenced(l); } -void gc_free_all_unreferenced_multisets() +void gc_free_all_unreferenced_multisets(void) { struct multiset *l,*next; diff --git a/src/multiset.h b/src/multiset.h index 1b83a925987d89864d9ec9bd99cd5626866eee26..7cc916a59462c4192423c3a88d75a0350d1f62b9 100644 --- a/src/multiset.h +++ b/src/multiset.h @@ -40,9 +40,9 @@ void f_aggregate_multiset(INT32 args); struct multiset *copy_multiset_recursively(struct multiset *l, struct processing *p); void gc_mark_multiset_as_referenced(struct multiset *l); -void gc_check_all_multisets(); -void gc_mark_all_multisets(); -void gc_free_all_unreferenced_multisets(); +void gc_check_all_multisets(void); +void gc_mark_all_multisets(void); +void gc_free_all_unreferenced_multisets(void); void count_memory_in_multisets(INT32 *num_, INT32 *size_); /* Prototypes end here */ diff --git a/src/object.c b/src/object.c index 5380ee7ec771964fdc7ef5ef706c660c5089d1a4..c57f1d9c42be21e1c790ad660a98b24b73b65f71 100644 --- a/src/object.c +++ b/src/object.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: object.c,v 1.20 1997/07/18 01:44:19 hubbe Exp $"); +RCSID("$Id: object.c,v 1.21 1997/08/30 18:35:45 grubba Exp $"); #include "object.h" #include "dynamic_buffer.h" #include "interpret.h" @@ -26,7 +26,7 @@ struct object *first_object; struct object fake_object = { 1 }; /* start with one reference */ -void setup_fake_object() +void setup_fake_object(void) { fake_object.prog=&fake_program; fake_object.next=0; @@ -39,6 +39,10 @@ struct object *low_clone(struct program *p) struct object *o; struct frame frame; +#ifdef PROFILING + p->num_clones++; +#endif /* PROFILING */ + GC_ALLOC(); o=(struct object *)xalloc(sizeof(struct object)-1+p->storage_needed); @@ -118,7 +122,7 @@ struct object *clone_object(struct program *p, int args) return o; } -struct object *get_master() +struct object *get_master(void) { extern char *master_file; struct pike_string *master_name; @@ -155,7 +159,7 @@ struct object *get_master() return master_object; } -struct object *master() +struct object *master(void) { struct object *o; o=get_master(); @@ -246,7 +250,7 @@ static struct callback *destruct_object_evaluator_callback =0; * destructed by really_free_object. It links the object back into the * list of objects first. Adds a reference, destructs it and then frees it. */ -void destruct_objects_to_destruct() +void destruct_objects_to_destruct(void) { struct object *o, *next; @@ -566,7 +570,7 @@ union anything *object_get_item_ptr(struct object *o, } #ifdef DEBUG -void verify_all_objects() +void verify_all_objects(void) { struct object *o; struct frame frame; @@ -685,7 +689,7 @@ int object_equal_p(struct object *a, struct object *b, struct processing *p) return 1; } -void cleanup_objects() +void cleanup_objects(void) { struct object *o, *next; for(o=first_object;o;o=next) @@ -818,7 +822,7 @@ void gc_mark_object_as_referenced(struct object *o) } } -void gc_check_all_objects() +void gc_check_all_objects(void) { struct object *o; for(o=first_object;o;o=o->next) @@ -847,7 +851,7 @@ void gc_check_all_objects() } } -void gc_mark_all_objects() +void gc_mark_all_objects(void) { struct object *o; for(o=first_object;o;o=o->next) @@ -855,7 +859,7 @@ void gc_mark_all_objects() gc_mark_object_as_referenced(o); } -void gc_free_all_unreferenced_objects() +void gc_free_all_unreferenced_objects(void) { struct object *o,*next; diff --git a/src/object.h b/src/object.h index 7cff78322e4ac3a7e3916b62c37579c564536f15..b184357d31a5057a7c0adbadf018ff09beddfc10 100644 --- a/src/object.h +++ b/src/object.h @@ -37,13 +37,13 @@ extern struct program *master_program; #define this_object() (fp->current_object->refs++,fp->current_object) /* Prototypes begin here */ -void setup_fake_object(); +void setup_fake_object(void); struct object *low_clone(struct program *p); struct object *clone_object(struct program *p, int args); -struct object *get_master(); -struct object *master(); +struct object *get_master(void); +struct object *master(void); void destruct(struct object *o); -void destruct_objects_to_destruct(); +void destruct_objects_to_destruct(void); void really_free_object(struct object *o); void low_object_index_no_free(struct svalue *to, struct object *o, @@ -63,15 +63,15 @@ void object_set_index(struct object *o, union anything *object_get_item_ptr(struct object *o, struct svalue *index, TYPE_T type); -void verify_all_objects(); +void verify_all_objects(void); int object_equal_p(struct object *a, struct object *b, struct processing *p); -void cleanup_objects(); +void cleanup_objects(void); struct array *object_indices(struct object *o); struct array *object_values(struct object *o); void gc_mark_object_as_referenced(struct object *o); -void gc_check_all_objects(); -void gc_mark_all_objects(); -void gc_free_all_unreferenced_objects(); +void gc_check_all_objects(void); +void gc_mark_all_objects(void); +void gc_free_all_unreferenced_objects(void); void count_memory_in_objects(INT32 *num_, INT32 *size_); /* Prototypes end here */ diff --git a/src/opcodes.c b/src/opcodes.c index 254a8c85514eddda4ab88fa0fa1c91752c943626..f933786e0cc2e40f24b50c3f6beb3936e38ead96 100644 --- a/src/opcodes.c +++ b/src/opcodes.c @@ -66,7 +66,7 @@ void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind) } } -void o_index() +void o_index(void) { index_no_free(sp,sp-2,sp-1); sp++; @@ -214,7 +214,7 @@ void cast(struct pike_string *s) } } -void f_cast() +void f_cast(void) { INT32 i; diff --git a/src/opcodes.h b/src/opcodes.h index 5993d54a06604b759582799e8e072ef6e8cb3e76..d190cf953dd6523dee3b5560262c22b06d817333 100644 --- a/src/opcodes.h +++ b/src/opcodes.h @@ -8,9 +8,9 @@ /* Prototypes begin here */ void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind); -void o_index(); +void o_index(void); void cast(struct pike_string *s); -void f_cast(); +void f_cast(void); void f_sscanf(INT32 args); /* Prototypes end here */ diff --git a/src/operators.c b/src/operators.c index 2fea7f42c42dc0a45e229c9d99502674b6eeee79..65fe8efb768149e92c52dab1374ad9f656a0a71c 100644 --- a/src/operators.c +++ b/src/operators.c @@ -5,7 +5,7 @@ \*/ #include <math.h> #include "global.h" -RCSID("$Id: operators.c,v 1.15 1997/05/19 23:31:04 hubbe Exp $"); +RCSID("$Id: operators.c,v 1.16 1997/08/30 18:35:48 grubba Exp $"); #include "interpret.h" #include "svalue.h" #include "multiset.h" @@ -333,7 +333,7 @@ static int generate_comparison(node *n) return 0; } -static int float_promote() +static int float_promote(void) { if(sp[-2].type==T_INT) { @@ -350,7 +350,7 @@ static int float_promote() return sp[-2].type == sp[-1].type; } -void o_subtract() +void o_subtract(void) { if (sp[-2].type != sp[-1].type && !float_promote() && @@ -449,7 +449,7 @@ static int generate_minus(node *n) return 0; } -void o_and() +void o_and(void) { if(sp[-1].type != sp[-2].type && sp[-2].type != T_OBJECT) @@ -585,7 +585,7 @@ static int generate_and(node *n) } } -void o_or() +void o_or(void) { if(sp[-1].type != sp[-2].type && sp[-2].type != T_OBJECT) @@ -686,7 +686,7 @@ static int generate_or(node *n) } -void o_xor() +void o_xor(void) { if(sp[-1].type != sp[-2].type && sp[-2].type != T_OBJECT) @@ -786,7 +786,7 @@ static int generate_xor(node *n) } } -void o_lsh() +void o_lsh(void) { if(sp[-2].type != T_INT) { @@ -821,7 +821,7 @@ static int generate_lsh(node *n) return 0; } -void o_rsh() +void o_rsh(void) { if(sp[-2].type != T_INT) { @@ -857,7 +857,7 @@ static int generate_rsh(node *n) #define TWO_TYPES(X,Y) (((X)<<8)|(Y)) -void o_multiply() +void o_multiply(void) { switch(TWO_TYPES(sp[-2].type,sp[-1].type)) { @@ -950,7 +950,7 @@ static int generate_multiply(node *n) } } -void o_divide() +void o_divide(void) { if(sp[-2].type!=sp[-1].type && !float_promote() && @@ -1028,7 +1028,7 @@ static int generate_divide(node *n) return 0; } -void o_mod() +void o_mod(void) { if(sp[-2].type != sp[-1].type && !float_promote() && @@ -1096,7 +1096,7 @@ static int generate_mod(node *n) return 0; } -void o_not() +void o_not(void) { switch(sp[-1].type) { @@ -1140,7 +1140,7 @@ static int generate_not(node *n) return 0; } -void o_compl() +void o_compl(void) { switch(sp[-1].type) { @@ -1192,7 +1192,7 @@ static int generate_compl(node *n) return 0; } -void o_negate() +void o_negate(void) { switch(sp[-1].type) { @@ -1213,7 +1213,7 @@ void o_negate() } } -void o_range() +void o_range(void) { INT32 from,to; @@ -1339,7 +1339,7 @@ static int generate_sizeof(node *n) return 1; } -void init_operators() +void init_operators(void) { add_efun2("`[]",f_index, "function(string,int:int)|function(object,string:mixed)|function(array,int:mixed)|function(mapping,mixed:mixed)|function(multiset,mixed:int)|function(string,int,int:string)|function(array,int,int:array)",OPT_TRY_OPTIMIZE,0,0); diff --git a/src/operators.h b/src/operators.h index 4887aa8d4917bda2331d276f7575d14215ffc13f..124c4264a7924bc3e88f3f837979939128f8c96c 100644 --- a/src/operators.h +++ b/src/operators.h @@ -17,34 +17,34 @@ COMPARISON(f_gt,"`>" , is_gt(sp-2,sp-1)) COMPARISON(f_ge,"`>=",!is_lt(sp-2,sp-1)) void f_add(INT32 args); -void o_subtract(); +void o_subtract(void); void f_minus(INT32 args); -void o_and(); +void o_and(void); void f_and(INT32 args); -void o_or(); +void o_or(void); void f_or(INT32 args); -void o_xor(); +void o_xor(void); void f_xor(INT32 args); -void o_lsh(); +void o_lsh(void); void f_lsh(INT32 args); -void o_rsh(); +void o_rsh(void); void f_rsh(INT32 args); -void o_multiply(); +void o_multiply(void); void f_multiply(INT32 args); -void o_divide(); +void o_divide(void); void f_divide(INT32 args); -void o_mod(); +void o_mod(void); void f_mod(INT32 args); -void o_not(); +void o_not(void); void f_not(INT32 args); -void o_compl(); +void o_compl(void); void f_compl(INT32 args); -void o_negate(); -void o_range(); +void o_negate(void); +void o_range(void); void f_index(INT32 args); void f_arrow(INT32 args); void f_sizeof(INT32 args); -void init_operators(); +void init_operators(void); /* Prototypes end here */ #undef COMPARISON diff --git a/src/peep.c b/src/peep.c index d92f78df27558a5f5eeaeabc575c3a8a37c9bb7a..92b620e729845f3cde40e083aea99d790338ef0e 100644 --- a/src/peep.c +++ b/src/peep.c @@ -29,12 +29,12 @@ static int hasarg(int opcode) return instrs[opcode-F_OFFSET].flags & I_HASARG; } -void init_bytecode() +void init_bytecode(void) { low_reinit_buf(&instrbuf); } -void exit_bytecode() +void exit_bytecode(void) { INT32 e,length; p_instr *c; @@ -368,7 +368,7 @@ int insopt2(int f, int cl, struct pike_string *cf) } -static void debug() +static void debug(void) { if(fifo_len > (long)instrbuf.s.len / (long)sizeof(p_instr)) fifo_len=(long)instrbuf.s.len / (long)sizeof(p_instr); @@ -424,7 +424,7 @@ static int argument(int offset) return -1; } -static void advance() +static void advance(void) { if(fifo_len) { diff --git a/src/peep.h b/src/peep.h index c76f810d038e0dc6bda6f87e6fe01f9ebffeae07..508e15eb0a7374058b3c8c660670c0c795097ee2 100644 --- a/src/peep.h +++ b/src/peep.h @@ -6,8 +6,8 @@ extern dynamic_buffer instrbuf; /* Prototypes begin here */ struct p_instr_s; -void init_bytecode(); -void exit_bytecode(); +void init_bytecode(void); +void exit_bytecode(void); int insert_opcode(unsigned int f, INT32 b, INT32 current_line, diff --git a/src/pike_types.c b/src/pike_types.c index 67771927b891fb5aaa00a72c0f0e3e099ff11950..97ec88495455786999414db60b60de2b499204f5 100644 --- a/src/pike_types.c +++ b/src/pike_types.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: pike_types.c,v 1.24 1997/08/21 00:47:42 hubbe Exp $"); +RCSID("$Id: pike_types.c,v 1.25 1997/08/30 18:35:51 grubba Exp $"); #include <ctype.h> #include "svalue.h" #include "pike_types.h" @@ -74,7 +74,7 @@ static void CHECK_TYPE(struct pike_string *s) #define CHECK_TYPE(X) #endif -void init_types() +void init_types(void) { string_type_string=parse_type("string"); int_type_string=parse_type("int"); @@ -145,7 +145,7 @@ void push_type(unsigned char tmp) yyerror("Type stack overflow."); } -void type_stack_mark() +void type_stack_mark(void) { *mark_stackp=type_stackp; mark_stackp++; @@ -153,7 +153,7 @@ void type_stack_mark() yyerror("Type mark stack overflow."); } -INT32 pop_stack_mark() +INT32 pop_stack_mark(void) { mark_stackp--; if(mark_stackp<mark_stack) @@ -162,14 +162,14 @@ INT32 pop_stack_mark() return type_stackp - *mark_stackp; } -void pop_type_stack() +void pop_type_stack(void) { type_stackp--; if(type_stackp<type_stack) fatal("Type stack underflow\n"); } -void type_stack_pop_to_mark() +void type_stack_pop_to_mark(void) { type_stackp-=pop_stack_mark(); #ifdef DEBUG @@ -178,13 +178,13 @@ void type_stack_pop_to_mark() #endif } -void reset_type_stack() +void reset_type_stack(void) { type_stack_pop_to_mark(); type_stack_mark(); } -void type_stack_reverse() +void type_stack_reverse(void) { INT32 a; a=pop_stack_mark(); @@ -212,7 +212,7 @@ void push_finished_type(struct pike_string *type) for(e=type->len-1;e>=0;e--) push_type(type->str[e]); } -struct pike_string *pop_unfinished_type() +struct pike_string *pop_unfinished_type(void) { int len,e; struct pike_string *s; @@ -226,7 +226,7 @@ struct pike_string *pop_unfinished_type() return s; } -struct pike_string *pop_type() +struct pike_string *pop_type(void) { struct pike_string *s; s=pop_unfinished_type(); @@ -1225,7 +1225,7 @@ char *get_name_of_type(int t) } } -void cleanup_pike_types() +void cleanup_pike_types(void) { free_string(string_type_string); free_string(int_type_string); diff --git a/src/pike_types.h b/src/pike_types.h index 427d6cac1f0d2e51f21f2d7ff35ff40857528734..0c407f8c10b288d39b5232c35756a018007ce92e 100644 --- a/src/pike_types.h +++ b/src/pike_types.h @@ -26,19 +26,19 @@ extern struct pike_string *any_type_string; #define exit_type_stack pop_stack_mark /* Prototypes begin here */ -void init_types(); +void init_types(void); void push_type(unsigned char tmp); -void type_stack_mark(); -INT32 pop_stack_mark(); -void pop_type_stack(); -void type_stack_pop_to_mark(); -void reset_type_stack(); -void type_stack_reverse(); +void type_stack_mark(void); +INT32 pop_stack_mark(void); +void pop_type_stack(void); +void type_stack_pop_to_mark(void); +void reset_type_stack(void); +void type_stack_reverse(void); void push_type_int(unsigned INT32 i); void push_unfinished_type(char *s); void push_finished_type(struct pike_string *type); -struct pike_string *pop_unfinished_type(); -struct pike_string *pop_type(); +struct pike_string *pop_unfinished_type(void); +struct pike_string *pop_type(void); struct pike_string *parse_type(char *s); void stupid_describe_type(char *a,INT32 len); void simple_describe_type(struct pike_string *s); @@ -55,7 +55,7 @@ struct pike_string *check_call(struct pike_string *args, struct pike_string *type); struct pike_string *get_type_of_svalue(struct svalue *s); char *get_name_of_type(int t); -void cleanup_pike_types(); +void cleanup_pike_types(void); /* Prototypes end here */ #endif diff --git a/src/program.c b/src/program.c index 4cc6967ce4067c4bc9ffbc04f80e93fb5dada746..b6fa5bd216ab0728f6cccc83e09896a30af9c44c 100644 --- a/src/program.c +++ b/src/program.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: program.c,v 1.36 1997/08/03 09:55:11 hubbe Exp $"); +RCSID("$Id: program.c,v 1.37 1997/08/30 18:35:53 grubba Exp $"); #include "program.h" #include "object.h" #include "dynamic_buffer.h" @@ -199,7 +199,7 @@ struct program *id_to_program(INT32 id) * normal program, but all pointers points to the program we are currently * compiling */ -void setup_fake_program() +void setup_fake_program(void) { fake_program.refs=0xffffff; SETUP(program, program_size, unsigned char, A_PROGRAM); @@ -217,6 +217,9 @@ void setup_fake_program() fake_program.lfuns=0; fake_prog.num_lfuns=0; */ +#ifdef PROFILING + fake_program.num_clones = 0; +#endif /* PROFILING */ fake_object.prog=&fake_program; } @@ -225,7 +228,7 @@ void setup_fake_program() /* * Start building a new program */ -void start_new_program() +void start_new_program(void) { int e; @@ -352,7 +355,7 @@ void dump_program_desc(struct program *p) } #endif -static void toss_compilation_resources() +static void toss_compilation_resources(void) { struct pike_string **names; struct svalue *modules; @@ -402,7 +405,7 @@ static void toss_compilation_resources() * Something went wrong. * toss resources of program we were building */ -void toss_current_program() +void toss_current_program(void) { setup_fake_program(); low_free_program(&fake_program); @@ -545,7 +548,7 @@ if((prog->PTRS = areas[AREA].s.len/sizeof(TYPE))) \ p+=MY_ALIGN(areas[AREA].s.len); \ } -struct program *end_program() +struct program *end_program(void) { struct pike_string **names; int size, i,e,t; @@ -599,6 +602,13 @@ struct program *end_program() INS_BLOCK(inherits,num_inherits,struct inherit,A_INHERITS); INS_BLOCK(constants,num_constants,struct svalue,A_CONSTANTS); +#ifdef PROFILING + /* There is probably a better place for this, but... */ + for (i=0; i < prog->num_identifiers; i++) { + prog->identifiers[i].num_calls = 0; + } +#endif /* PROFILING */ + /* Ok, sort for binsearch */ prog->identifier_index=(unsigned short *)p; for(e=i=0;i<(int)prog->num_identifier_references;i++) @@ -926,6 +936,10 @@ int low_define_variable(struct pike_string *name, dummy.run_time_type=run_time_type; dummy.func.offset=offset; +#ifdef PROFILING + dummy.num_calls = 0; +#endif /* PROFILING */ + ref.flags=flags; ref.identifier_offset=areas[A_IDENTIFIERS].s.len / sizeof dummy; ref.inherit_offset=0; @@ -1029,6 +1043,11 @@ int add_constant(struct pike_string *name, dummy.func.offset=store_constant(c, 0); +#ifdef PROFILING + /* Not strictly necessary, but... */ + dummy.num_calls = 0; +#endif /* PROFILING */ + ref.flags=flags; ref.identifier_offset=fake_program.num_identifiers; ref.inherit_offset=0; @@ -1216,6 +1235,10 @@ INT32 define_function(struct pike_string *name, else fun.func.offset = -1; +#ifdef PROFILING + fun.num_calls = 0; +#endif /* PROFILING */ + ref.identifier_offset=fake_program.num_identifiers; add_to_mem_block(A_IDENTIFIERS, (char *)&fun, sizeof(fun)); } @@ -1513,9 +1536,9 @@ void my_yyerror(char *fmt,...) /* * Compile an PIKE file. Input is supposed to be initalized already. */ -void compile() +void compile(void) { - int yyparse(); + int yyparse(void); start_line_numbering(); @@ -1622,7 +1645,7 @@ void add_function(char *name,void (*cfun)(INT32),char *type,INT16 flags) } #ifdef DEBUG -void check_all_programs() +void check_all_programs(void) { struct program *p; for(p=first_program;p;p=p->next) @@ -1649,7 +1672,7 @@ void check_all_programs() } #endif -void cleanup_program() +void cleanup_program(void) { #ifdef FIND_FUNCTION_HASHSIZE int e; @@ -1672,7 +1695,7 @@ void gc_mark_program_as_referenced(struct program *p) gc_mark_svalues(p->constants, p->num_constants); } -void gc_check_all_programs() +void gc_check_all_programs(void) { struct program *p; for(p=first_program;p;p=p->next) @@ -1694,7 +1717,7 @@ void gc_check_all_programs() } } -void gc_mark_all_programs() +void gc_mark_all_programs(void) { struct program *p; for(p=first_program;p;p=p->next) @@ -1702,7 +1725,7 @@ void gc_mark_all_programs() gc_mark_program_as_referenced(p); } -void gc_free_all_unreferenced_programs() +void gc_free_all_unreferenced_programs(void) { struct program *p,*next; @@ -1735,7 +1758,7 @@ void count_memory_in_programs(INT32 *num_, INT32 *size_) *num_=num; *size_=size; } -void push_locals() +void push_locals(void) { struct locals *l; l=ALLOC_STRUCT(locals); @@ -1747,7 +1770,7 @@ void push_locals() local_variables=l; } -void pop_locals() +void pop_locals(void) { struct locals *l; free_all_local_names(); diff --git a/src/program.h b/src/program.h index 10f41ab3e79560b36dc2705e9c454c1c4b4ef070..bffba84517767107a91ff5f55573e7f3a60cb60d 100644 --- a/src/program.h +++ b/src/program.h @@ -96,6 +96,9 @@ struct identifier struct pike_string *type; unsigned INT16 flags; /* IDENTIFIER_??? */ unsigned INT16 run_time_type; +#ifdef PROFILING + unsigned INT32 num_calls; +#endif /* PROFILING */ union idptr func; }; @@ -153,6 +156,9 @@ struct program #ifdef DEBUG unsigned INT32 checksum; #endif +#ifdef PROFILING + unsigned INT32 num_clones; +#endif /* PROFILING */ SIZE_T total_size; SIZE_T num_linenumbers; @@ -182,13 +188,13 @@ extern struct program fake_program; void use_module(struct svalue *s); int find_module_identifier(struct pike_string *ident); struct program *id_to_program(INT32 id); -void setup_fake_program(); -void start_new_program(); +void setup_fake_program(void); +void start_new_program(void); void really_free_program(struct program *p); void dump_program_desc(struct program *p); -void toss_current_program(); +void toss_current_program(void); void check_program(struct program *p); -struct program *end_program(); +struct program *end_program(void); SIZE_T add_storage(SIZE_T size); void set_init_callback(void (*init)(struct object *)); void set_exit_callback(void (*exit)(struct object *)); @@ -248,20 +254,20 @@ void start_line_numbering(void); void store_linenumber(INT32 current_line, struct pike_string *current_file); char *get_line(unsigned char *pc,struct program *prog,INT32 *linep); void my_yyerror(char *fmt,...); -void compile(); +void compile(void); struct program *compile_file(struct pike_string *file_name); struct program *compile_string(struct pike_string *prog, struct pike_string *name); void add_function(char *name,void (*cfun)(INT32),char *type,INT16 flags); -void check_all_programs(); -void cleanup_program(); +void check_all_programs(void); +void cleanup_program(void); void gc_mark_program_as_referenced(struct program *p); -void gc_check_all_programs(); -void gc_mark_all_programs(); -void gc_free_all_unreferenced_programs(); +void gc_check_all_programs(void); +void gc_mark_all_programs(void); +void gc_free_all_unreferenced_programs(void); void count_memory_in_programs(INT32 *num_, INT32 *size_); -void push_locals(); -void pop_locals(); +void push_locals(void); +void pop_locals(void); char *get_storage(struct object *o, struct program *p); /* Prototypes end here */ diff --git a/src/rusage.c b/src/rusage.c index 03cea1659a59eb7ac1379f6222b89948b67bf594..e206f95a264835b4e79bc8a52c368ec17dbbc168 100644 --- a/src/rusage.c +++ b/src/rusage.c @@ -38,7 +38,7 @@ static INLINE int get_time_int(timestruc_t * val) int proc_fd = -1; -INT32 *low_rusage() +INT32 *low_rusage(void) { prusage_t pru; prstatus_t prs; @@ -109,7 +109,7 @@ INT32 *low_rusage() #include <sys/rusage.h> #endif -INT32 *low_rusage() +INT32 *low_rusage(void) { struct rusage rus; long utime, stime; @@ -153,7 +153,7 @@ INT32 *low_rusage() #define NEED_CONVERT_TIME static long convert_time(long t,long tick); -INT32 *low_rusage() +INT32 *low_rusage(void) { struct tms tms; rusage_values[18] = convert_time(times(&tms), CLK_TCK); @@ -167,7 +167,7 @@ INT32 *low_rusage() #define NEED_CONVERT_TIME static long convert_time(long t,long tick); -INT32 *low_rusage() +INT32 *low_rusage(void) { rusage_values[0]= convert_time(clock(), CLOCKS_PER_SECOND); return rusage_values; @@ -175,7 +175,7 @@ INT32 *low_rusage() #else /* HAVE_CLOCK */ -INT32 *low_rusage() +INT32 *low_rusage(void) { /* This is totally wrong, but hey, if you can't do it _right_... */ struct timeval tm; @@ -200,7 +200,7 @@ static long convert_time(long t,long tick) } #endif -INT32 internal_rusage() +INT32 internal_rusage(void) { low_rusage(); return rusage_values[0]; diff --git a/src/rusage.h b/src/rusage.h index f13084e124ad857ca503c1e624b29c601139c358..cd4c2c552bdfedffac079cc916b5cd36131b96fc 100644 --- a/src/rusage.h +++ b/src/rusage.h @@ -7,8 +7,8 @@ #define RUSAGE_H /* Prototypes begin here */ -INT32 *low_rusage(); -INT32 internal_rusage(); +INT32 *low_rusage(void); +INT32 internal_rusage(void); /* Prototypes end here */ #endif diff --git a/src/signal_handler.c b/src/signal_handler.c index 2ff2103b9ffaa30a5985acc235475bb57991d3e6..0b2f26b7b80257585e2e5db16b8a8912fba99827 100644 --- a/src/signal_handler.c +++ b/src/signal_handler.c @@ -254,7 +254,7 @@ void check_signals(struct callback *foo, void *bar, void *gazonk) ONERROR ebuf; #ifdef DEBUG extern int d_flag; - if(d_flag>5) do_debug(0); + if(d_flag>5) do_debug(); #endif if(firstsig != lastsig && !signalling) @@ -457,7 +457,7 @@ static void f_ualarm(INT32 args) } #endif -void init_signals() +void init_signals(void) { int e; @@ -480,7 +480,7 @@ void init_signals() #endif } -void exit_signals() +void exit_signals(void) { int e; for(e=0;e<MAX_SIGNALS;e++) diff --git a/src/signal_handler.h b/src/signal_handler.h index cee27e54239318dc4a796ff045ca1550dd1f1f8a..9a83975b45f1e42c129940c742c4529ac44135a5 100644 --- a/src/signal_handler.h +++ b/src/signal_handler.h @@ -9,8 +9,8 @@ /* Prototypes begin here */ struct sigdesc; void check_signals(struct callback *foo, void *bar, void *gazonk); -void init_signals(); -void exit_signals(); +void init_signals(void); +void exit_signals(void); /* Prototypes end here */ #endif diff --git a/src/stralloc.c b/src/stralloc.c index 4e71ee19dd92f9d3b0a6ba5fd957d6ebc4ac520e..c126a6005b1f9ca921718a6124a299ad1c73975b 100644 --- a/src/stralloc.c +++ b/src/stralloc.c @@ -100,7 +100,7 @@ static void rehash_string_backwards(struct pike_string *s) base_table[h]=s; } -static void rehash() +static void rehash(void) { int h,old; struct pike_string **old_base; @@ -288,7 +288,7 @@ void check_string(struct pike_string *s) fatal("Shared string is not zero terminated properly.\n"); } -void verify_shared_strings_tables() +void verify_shared_strings_tables(void) { unsigned INT32 e, h; struct pike_string *s; @@ -369,7 +369,7 @@ struct pike_string *debug_findstring(const struct pike_string *foo) return tmp; } -void dump_stralloc_strings() +void dump_stralloc_strings(void) { unsigned INT32 e; struct pike_string *p; @@ -572,14 +572,14 @@ struct pike_string *string_replace(struct pike_string *str, } /*** init/exit memory ***/ -void init_shared_string_table() +void init_shared_string_table(void) { htable_size=BEGIN_HASH_SIZE; base_table=(struct pike_string **)xalloc(sizeof(struct pike_string *)*htable_size); MEMSET((char *)base_table,0,sizeof(struct pike_string *)*htable_size); } -void cleanup_shared_string_table() +void cleanup_shared_string_table(void) { unsigned INT32 e; struct pike_string *s,*next; @@ -623,7 +623,7 @@ void count_memory_in_strings(INT32 *num, INT32 *size) #ifdef GC2 -void gc_mark_all_strings() +void gc_mark_all_strings(void) { unsigned INT32 e; if(!base_table) return; diff --git a/src/stralloc.h b/src/stralloc.h index 80ef15d45bc001ea4bf2946fd3f7af45e53f86f6..397c8d639f76cd163cc6a525178f3a1397d6a481 100644 --- a/src/stralloc.h +++ b/src/stralloc.h @@ -45,9 +45,9 @@ void unlink_pike_string(struct pike_string *s); void really_free_string(struct pike_string *s); struct pike_string *add_string_status(int verbose); void check_string(struct pike_string *s); -void verify_shared_strings_tables(); +void verify_shared_strings_tables(void); struct pike_string *debug_findstring(const struct pike_string *foo); -void dump_stralloc_strings(); +void dump_stralloc_strings(void); int low_quick_binary_strcmp(char *a,INT32 alen, char *b,INT32 blen); int my_quick_strcmp(struct pike_string *a,struct pike_string *b); @@ -59,10 +59,10 @@ struct pike_string *add_shared_strings(struct pike_string *a, struct pike_string *string_replace(struct pike_string *str, struct pike_string *del, struct pike_string *to); -void init_shared_string_table(); -void cleanup_shared_string_table(); +void init_shared_string_table(void); +void cleanup_shared_string_table(void); void count_memory_in_strings(INT32 *num, INT32 *size); -void gc_mark_all_strings(); +void gc_mark_all_strings(void); /* Prototypes end here */ #endif /* STRALLOC_H */ diff --git a/src/svalue.c b/src/svalue.c index b261d12f5171d69308b0bcbd59434bef8e239a74..6eee2ae8a5c4b2b55fcec73f68eb0fa97db2eae7 100644 --- a/src/svalue.c +++ b/src/svalue.c @@ -904,6 +904,10 @@ void gc_xmark_svalues(struct svalue *s, int num) { INT32 e; + if (!s) { + return; + } + for(e=0;e<num;e++,s++) { check_type(s->type); diff --git a/src/threads.c b/src/threads.c index b87be89dc3b8363f210a1bdb33b3e1052886ecc6..f11e3d42b9f910f61f58c4f53fc20f45a89b0683 100644 --- a/src/threads.c +++ b/src/threads.c @@ -1,5 +1,5 @@ #include "global.h" -RCSID("$Id: threads.c,v 1.23 1997/04/20 03:53:35 grubba Exp $"); +RCSID("$Id: threads.c,v 1.24 1997/08/30 18:36:01 grubba Exp $"); int num_threads = 1; int threads_disabled = 0; @@ -12,6 +12,7 @@ int threads_disabled = 0; #include "callback.h" #include "builtin_functions.h" #include "constants.h" +#include "program.h" struct object *thread_id; @@ -312,7 +313,7 @@ void f_cond_broadcast(INT32 args) { pop_n_elems(args); co_broadcast(THIS_COND); void init_cond_obj(struct object *o) { co_init(THIS_COND); } void exit_cond_obj(struct object *o) { co_destroy(THIS_COND); } -void th_init() +void th_init(void) { struct program *tmp; @@ -372,7 +373,7 @@ void th_init() thread_id=clone_object(thread_id_prog,0); } -void th_cleanup() +void th_cleanup(void) { if(mutex_key) { diff --git a/src/threads.h b/src/threads.h index 8230fcb022eb2dc306e8436ea55c3a204b1341c0..b09f56d4915e020c19138e8f303911a366563fd3 100644 --- a/src/threads.h +++ b/src/threads.h @@ -4,7 +4,10 @@ #include "machine.h" #include "interpret.h" #include "error.h" - +#ifdef HAVE_SYS_TYPES_H +/* Needed for pthread_t on OSF/1 */ +#include <sys/types.h> +#endif /* HAVE_SYS_TYPES_H */ #ifdef _REENTRANT /* @@ -203,7 +206,7 @@ struct thread_starter; void *new_thread_func(void * data); void f_thread_create(INT32 args); void f_this_thread(INT32 args); -void th_init(); +void th_init(void); struct mutex_storage; struct key_storage; void f_mutex_lock(INT32 args); @@ -217,7 +220,7 @@ void f_cond_signal(INT32 args); void f_cond_broadcast(INT32 args); void init_cond_obj(struct object *o); void exit_cond_obj(struct object *o); -void th_cleanup(); +void th_cleanup(void); /* Prototypes end here */ #else