1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Protoized old pre-ANSI K&R style declarations and definitions

This commit is contained in:
Nobuyoshi Nakada 2021-05-07 00:04:36 +09:00
parent 99644514db
commit 0bbab1e515
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
10 changed files with 22 additions and 20 deletions

16
dln.c
View file

@ -312,7 +312,7 @@ dln_load(const char *file)
HINSTANCE handle;
WCHAR *winfile;
char message[1024];
void (*init_fct)();
void (*init_fct)(void);
char *buf;
/* Load the file as an object one */
@ -341,7 +341,7 @@ dln_load(const char *file)
}
#endif
if ((init_fct = (void(*)())GetProcAddress(handle, buf)) == NULL) {
if ((init_fct = (void(*)(void))GetProcAddress(handle, buf)) == NULL) {
dln_loaderror("%s - %s\n%s", dln_strerror(), buf, file);
}
@ -358,7 +358,7 @@ dln_load(const char *file)
#define DLN_DEFINED
{
void *handle;
void (*init_fct)();
void (*init_fct)(void);
#ifndef RTLD_LAZY
# define RTLD_LAZY 1
@ -393,7 +393,7 @@ dln_load(const char *file)
}
# endif
init_fct = (void(*)())(VALUE)dlsym(handle, buf);
init_fct = (void(*)(void))(VALUE)dlsym(handle, buf);
if (init_fct == NULL) {
const size_t errlen = strlen(error = dln_strerror()) + 1;
error = memcpy(ALLOCA_N(char, errlen), error, errlen);
@ -412,7 +412,7 @@ dln_load(const char *file)
{
shl_t lib = NULL;
int flags;
void (*init_fct)();
void (*init_fct)(void);
flags = BIND_DEFERRED;
lib = shl_load(file, flags, 0);
@ -436,9 +436,9 @@ dln_load(const char *file)
#if defined(_AIX)
#define DLN_DEFINED
{
void (*init_fct)();
void (*init_fct)(void);
init_fct = (void(*)())load((char*)file, 1, 0);
init_fct = (void(*)(void))load((char*)file, 1, 0);
if (init_fct == NULL) {
aix_loaderror(file);
}
@ -467,7 +467,7 @@ dln_load(const char *file)
/* "file" is module file name .
"buf" is pointer to initial function name with "_" . */
void (*init_fct)();
void (*init_fct)(void);
dyld_result = NSCreateObjectFileImageFromFile(file, &obj_file);

View file

@ -48,7 +48,7 @@ rb_f_at_exit(VALUE _)
}
struct end_proc_data {
void (*func) ();
void (*func) (VALUE);
VALUE data;
struct end_proc_data *next;
};

4
gc.c
View file

@ -2382,7 +2382,7 @@ rvargc_find_region(size_t size, rb_ractor_t *cr, RVALUE *freelist)
#endif
int
rb_slot_size()
rb_slot_size(void)
{
return sizeof(RVALUE);
}
@ -4592,7 +4592,7 @@ obj_memsize_of(VALUE obj, int use_all_types)
case T_HASH:
if (RHASH_AR_TABLE_P(obj)) {
if (RHASH_AR_TABLE(obj) != NULL) {
size_t rb_hash_ar_table_size();
size_t rb_hash_ar_table_size(void);
size += rb_hash_ar_table_size();
}
}

2
hash.c
View file

@ -4820,7 +4820,7 @@ extern char **environ;
#endif
static inline rb_encoding *
env_encoding()
env_encoding(void)
{
#ifdef _WIN32
return rb_utf8_encoding();

View file

@ -47,7 +47,7 @@ typedef pthread_cond_t rb_nativethread_cond_t;
RUBY_SYMBOL_EXPORT_BEGIN
rb_nativethread_id_t rb_nativethread_self();
rb_nativethread_id_t rb_nativethread_self(void);
void rb_nativethread_lock_initialize(rb_nativethread_lock_t *lock);
void rb_nativethread_lock_destroy(rb_nativethread_lock_t *lock);

View file

@ -114,7 +114,7 @@ void rb_gc_mark_vm_stack_values(long n, const VALUE *values);
void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2));
void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2, 3));
void ruby_sized_xfree(void *x, size_t size);
int rb_slot_size();
int rb_slot_size(void);
RUBY_SYMBOL_EXPORT_END
MJIT_SYMBOL_EXPORT_BEGIN

View file

@ -102,7 +102,7 @@ RUBY_SYMBOL_EXPORT_BEGIN
#ifdef RB_THREAD_LOCAL_SPECIFIER
#ifdef __APPLE__
// on Darwin, TLS can not be accessed across .so
struct rb_execution_context_struct *rb_current_ec();
struct rb_execution_context_struct *rb_current_ec(void);
void rb_current_ec_set(struct rb_execution_context_struct *);
#else
RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec;

View file

@ -1857,7 +1857,7 @@ vm_search_method(VALUE cd_owner, struct rb_call_data *cd, VALUE recv)
}
static inline int
check_cfunc(const rb_callable_method_entry_t *me, VALUE (*func)())
check_cfunc(const rb_callable_method_entry_t *me, VALUE (*func)(ANYARGS))
{
if (! me) {
return false;
@ -1876,7 +1876,7 @@ check_cfunc(const rb_callable_method_entry_t *me, VALUE (*func)())
}
static inline int
vm_method_cfunc_is(const rb_iseq_t *iseq, CALL_DATA cd, VALUE recv, VALUE (*func)())
vm_method_cfunc_is(const rb_iseq_t *iseq, CALL_DATA cd, VALUE recv, VALUE (*func)(ANYARGS))
{
VM_ASSERT(iseq != NULL);
const struct rb_callcache *cc = vm_search_method((VALUE)iseq, cd, recv);

View file

@ -416,7 +416,7 @@ static VALUE
}
static void
setup_method_cfunc_struct(rb_method_cfunc_t *cfunc, VALUE (*func)(), int argc)
setup_method_cfunc_struct(rb_method_cfunc_t *cfunc, VALUE (*func)(ANYARGS), int argc)
{
cfunc->func = func;
cfunc->argc = argc;

View file

@ -166,6 +166,8 @@ struct __sbuf {
*
* NB: see WARNING above before changing the layout of this structure!
*/
struct __suio;
typedef struct __sFILE {
unsigned char *_p; /* current position in (some) buffer */
#if 0
@ -178,8 +180,8 @@ typedef struct __sFILE {
#if 0
size_t _lbfsize; /* 0 or -_bf._size, for inline putc */
#endif
int (*vwrite)(/* struct __sFILE*, struct __suio * */);
const char *(*vextra)(/* struct __sFILE*, size_t, void*, long*, int */);
int (*vwrite)(struct __sFILE*, struct __suio *);
const char *(*vextra)(struct __sFILE*, size_t, void*, long*, int);
} FILE;