mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Prefer rb_module_new() over rb_define_module_id()
rb_define_module_id() doesn't do anything with its parameter so it's a bit confusing.
This commit is contained in:
		
							parent
							
								
									526d0f46f3
								
							
						
					
					
						commit
						e0944bde91
					
				
					 2 changed files with 4 additions and 3 deletions
				
			
		
							
								
								
									
										5
									
								
								class.c
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								class.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -859,6 +859,7 @@ rb_module_new(void)
 | 
			
		|||
    return (VALUE)mdl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Kept for compatibility. Use rb_module_new() instead.
 | 
			
		||||
VALUE
 | 
			
		||||
rb_define_module_id(ID id)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -882,7 +883,7 @@ rb_define_module(const char *name)
 | 
			
		|||
        rb_vm_add_root_module(module);
 | 
			
		||||
	return module;
 | 
			
		||||
    }
 | 
			
		||||
    module = rb_define_module_id(id);
 | 
			
		||||
    module = rb_module_new();
 | 
			
		||||
    rb_vm_add_root_module(module);
 | 
			
		||||
    rb_const_set(rb_cObject, id, module);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -909,7 +910,7 @@ rb_define_module_id_under(VALUE outer, ID id)
 | 
			
		|||
	}
 | 
			
		||||
	return module;
 | 
			
		||||
    }
 | 
			
		||||
    module = rb_define_module_id(id);
 | 
			
		||||
    module = rb_module_new();
 | 
			
		||||
    rb_const_set(outer, id, module);
 | 
			
		||||
    rb_set_class_path_string(module, outer, rb_id2str(id));
 | 
			
		||||
    rb_gc_register_mark_object(module);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4043,7 +4043,7 @@ static VALUE
 | 
			
		|||
vm_declare_module(ID id, VALUE cbase)
 | 
			
		||||
{
 | 
			
		||||
    /* new module declaration */
 | 
			
		||||
    return declare_under(id, cbase, rb_define_module_id(id));
 | 
			
		||||
    return declare_under(id, cbase, rb_module_new());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
NORETURN(static void unmatched_redefinition(const char *type, VALUE cbase, ID id, VALUE old));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue