mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/-test-/bug_reporter/bug_reporter.c (sample_bug_reporter): cast via uintptr_t to suppress warning cast between pointer and different size integer by gcc 4.8. * ext/-test-/bug_reporter/bug_reporter.c (register_sample_bug_reporter): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			543 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			543 B
		
	
	
	
		
			C
		
	
	
	
	
	
#include <ruby.h>
 | 
						|
#include <stdio.h>
 | 
						|
 | 
						|
int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
 | 
						|
 | 
						|
static void
 | 
						|
sample_bug_reporter(FILE *out, void *ptr)
 | 
						|
{
 | 
						|
    int n = (int)(uintptr_t)ptr;
 | 
						|
    fprintf(out, "Sample bug reporter: %d\n", n);
 | 
						|
}
 | 
						|
 | 
						|
static VALUE
 | 
						|
register_sample_bug_reporter(VALUE self, VALUE obj)
 | 
						|
{
 | 
						|
    rb_bug_reporter_add(sample_bug_reporter, (void *)(uintptr_t)NUM2INT(obj));
 | 
						|
    return Qnil;
 | 
						|
}
 | 
						|
 | 
						|
void
 | 
						|
Init_bug_reporter(void)
 | 
						|
{
 | 
						|
    rb_define_global_function("register_sample_bug_reporter", register_sample_bug_reporter, 1);
 | 
						|
}
 |