mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	struct.c: hide member names
* struct.c (rb_struct_define_without_accessor, rb_struct_define), (rb_struct_s_def): hide member names array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									5e5690781c
								
							
						
					
					
						commit
						a69c74be72
					
				
					 2 changed files with 7 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,7 @@
 | 
			
		|||
Sat Apr 13 10:20:32 2013  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
Sat Apr 13 10:20:37 2013  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* struct.c (rb_struct_define_without_accessor, rb_struct_define),
 | 
			
		||||
	  (rb_struct_s_def): hide member names array.
 | 
			
		||||
 | 
			
		||||
	* struct.c (anonymous_struct, new_struct, setup_struct): split
 | 
			
		||||
	  make_struct() for each purpose.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								struct.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								struct.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -243,7 +243,7 @@ rb_struct_define_without_accessor(const char *class_name, VALUE super, rb_alloc_
 | 
			
		|||
    VALUE members;
 | 
			
		||||
    char *name;
 | 
			
		||||
 | 
			
		||||
    members = rb_ary_new2(0);
 | 
			
		||||
    members = rb_ary_tmp_new(0);
 | 
			
		||||
    va_start(ar, alloc);
 | 
			
		||||
    while ((name = va_arg(ar, char*)) != NULL) {
 | 
			
		||||
        rb_ary_push(members, ID2SYM(rb_intern(name)));
 | 
			
		||||
| 
						 | 
				
			
			@ -275,7 +275,7 @@ rb_struct_define(const char *name, ...)
 | 
			
		|||
    VALUE st, ary;
 | 
			
		||||
    char *mem;
 | 
			
		||||
 | 
			
		||||
    ary = rb_ary_new();
 | 
			
		||||
    ary = rb_ary_tmp_new(0);
 | 
			
		||||
 | 
			
		||||
    va_start(ar, name);
 | 
			
		||||
    while ((mem = va_arg(ar, char*)) != 0) {
 | 
			
		||||
| 
						 | 
				
			
			@ -351,7 +351,7 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
 | 
			
		|||
	--argc;
 | 
			
		||||
	++argv;
 | 
			
		||||
    }
 | 
			
		||||
    rest = rb_ary_new2(argc);
 | 
			
		||||
    rest = rb_ary_tmp_new(argc);
 | 
			
		||||
    for (i=0; i<argc; i++) {
 | 
			
		||||
	id = rb_to_id(argv[i]);
 | 
			
		||||
	RARRAY_PTR(rest)[i] = ID2SYM(id);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue