mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Add documentation to "dcompact" callback and "parent" member
This commit is contained in:
		
							parent
							
								
									326d89b7ce
								
							
						
					
					
						commit
						92b2d5816a
					
				
				
				Notes:
				
					git
				
				2020-08-26 02:51:15 +09:00 
				
			
			
			
		
		
					 1 changed files with 11 additions and 2 deletions
				
			
		|  | @ -676,7 +676,8 @@ member of the struct. | ||||||
|                   void (*dmark)(void*); |                   void (*dmark)(void*); | ||||||
|                   void (*dfree)(void*); |                   void (*dfree)(void*); | ||||||
|                   size_t (*dsize)(const void *); |                   size_t (*dsize)(const void *); | ||||||
|                   void *reserved[2]; |                   void (*dcompact)(void*); | ||||||
|  |                   void *reserved[1]; | ||||||
|           } function; |           } function; | ||||||
|           const rb_data_type_t *parent; |           const rb_data_type_t *parent; | ||||||
|           void *data; |           void *data; | ||||||
|  | @ -708,7 +709,15 @@ Its parameter is a pointer to your struct. | ||||||
| You can pass 0 as dsize if it is hard to implement such a function. | You can pass 0 as dsize if it is hard to implement such a function. | ||||||
| But it is still recommended to avoid 0. | But it is still recommended to avoid 0. | ||||||
| 
 | 
 | ||||||
| You have to fill reserved and parent with 0. | dcompact is invoked when memory compaction took place. | ||||||
|  | Referred Ruby objects that were marked by rb_gc_mark_movable() | ||||||
|  | can here be updated per rb_gc_location(). | ||||||
|  | 
 | ||||||
|  | You have to fill reserved with 0. | ||||||
|  | 
 | ||||||
|  | parent can point to another C type definition that the Ruby object | ||||||
|  | is inherited from. Then TypedData_Get_Struct() does also accept | ||||||
|  | derived objects. | ||||||
| 
 | 
 | ||||||
| You can fill "data" with an arbitrary value for your use. | You can fill "data" with an arbitrary value for your use. | ||||||
| Ruby does nothing with the member. | Ruby does nothing with the member. | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lars Kanis
						Lars Kanis