debase-ruby_core_source 0.10.10 → 0.10.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +6 -3
  3. data/debase-ruby_core_source.gemspec +4 -4
  4. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/addr2line.h +20 -0
  5. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/builtin.h +83 -0
  6. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ccan/build_assert/build_assert.h +40 -0
  7. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ccan/check_type/check_type.h +63 -0
  8. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ccan/container_of/container_of.h +142 -0
  9. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ccan/list/list.h +788 -0
  10. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ccan/str/str.h +16 -0
  11. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/constant.h +55 -0
  12. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/debug_counter.h +457 -0
  13. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/dln.h +36 -0
  14. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/encindex.h +70 -0
  15. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/eval_intern.h +323 -0
  16. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/gc.h +140 -0
  17. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/hrtime.h +168 -0
  18. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/id.h +290 -0
  19. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/id_table.h +36 -0
  20. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/insns.inc +249 -0
  21. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/insns_info.inc +8983 -0
  22. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/array.h +119 -0
  23. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/bignum.h +246 -0
  24. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/bits.h +566 -0
  25. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/class.h +174 -0
  26. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compar.h +50 -0
  27. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compile.h +32 -0
  28. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compilers.h +108 -0
  29. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/complex.h +29 -0
  30. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/cont.h +25 -0
  31. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/dir.h +17 -0
  32. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enc.h +20 -0
  33. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/encoding.h +28 -0
  34. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enum.h +19 -0
  35. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enumerator.h +22 -0
  36. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/error.h +124 -0
  37. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/eval.h +33 -0
  38. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/file.h +39 -0
  39. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/fixnum.h +185 -0
  40. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/gc.h +161 -0
  41. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/hash.h +241 -0
  42. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/imemo.h +243 -0
  43. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/inits.h +51 -0
  44. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/io.h +35 -0
  45. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/load.h +19 -0
  46. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/loadpath.h +17 -0
  47. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/math.h +24 -0
  48. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/missing.h +19 -0
  49. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/numeric.h +255 -0
  50. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/object.h +83 -0
  51. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/parse.h +23 -0
  52. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/proc.h +33 -0
  53. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/process.h +136 -0
  54. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/random.h +17 -0
  55. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/range.h +41 -0
  56. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/rational.h +71 -0
  57. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/re.h +29 -0
  58. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/sanitizers.h +191 -0
  59. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/scheduler.h +44 -0
  60. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/serial.h +24 -0
  61. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/signal.h +22 -0
  62. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/static_assert.h +17 -0
  63. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/string.h +140 -0
  64. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/struct.h +154 -0
  65. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/symbol.h +41 -0
  66. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/thread.h +54 -0
  67. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/time.h +35 -0
  68. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/transcode.h +21 -0
  69. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/util.h +31 -0
  70. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/variable.h +84 -0
  71. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/vm.h +136 -0
  72. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/warnings.h +17 -0
  73. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal.h +107 -0
  74. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/iseq.h +305 -0
  75. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/known_errors.inc +791 -0
  76. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/method.h +245 -0
  77. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/mjit.h +220 -0
  78. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/mjit_compile.inc +8240 -0
  79. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/node.h +484 -0
  80. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/node_name.inc +210 -0
  81. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/opt_sc.inc +109 -0
  82. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/optinsn.inc +128 -0
  83. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/optunifs.inc +43 -0
  84. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/parse.h +211 -0
  85. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/probes_helper.h +44 -0
  86. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ractor_core.h +343 -0
  87. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/regenc.h +254 -0
  88. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/regint.h +938 -0
  89. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/regparse.h +370 -0
  90. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/revision.h +2 -0
  91. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ruby_assert.h +15 -0
  92. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ruby_atomic.h +23 -0
  93. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/siphash.h +48 -0
  94. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/symbol.h +119 -0
  95. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/thread_pthread.h +115 -0
  96. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/thread_win32.h +61 -0
  97. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/timev.h +57 -0
  98. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/transcode_data.h +138 -0
  99. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/transient_heap.h +65 -0
  100. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/variable.h +22 -0
  101. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/version.h +89 -0
  102. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm.inc +5355 -0
  103. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_call_iseq_optimized.inc +244 -0
  104. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_callinfo.h +456 -0
  105. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_core.h +2023 -0
  106. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_debug.h +116 -0
  107. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_exec.h +196 -0
  108. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_insnhelper.h +257 -0
  109. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_opts.h +73 -0
  110. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_sync.h +136 -0
  111. data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vmtc.inc +243 -0
  112. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/addr2line.h +20 -0
  113. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/builtin.h +84 -0
  114. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ccan/build_assert/build_assert.h +40 -0
  115. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ccan/check_type/check_type.h +63 -0
  116. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ccan/container_of/container_of.h +142 -0
  117. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ccan/list/list.h +788 -0
  118. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ccan/str/str.h +16 -0
  119. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/constant.h +55 -0
  120. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/darray.h +198 -0
  121. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/debug_counter.h +469 -0
  122. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/dln.h +31 -0
  123. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/encindex.h +70 -0
  124. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/eval_intern.h +335 -0
  125. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/gc.h +141 -0
  126. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/hrtime.h +168 -0
  127. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/id.h +293 -0
  128. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/id_table.h +36 -0
  129. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/insns.inc +249 -0
  130. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/insns_info.inc +9063 -0
  131. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/array.h +113 -0
  132. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/bignum.h +246 -0
  133. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/bits.h +565 -0
  134. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/class.h +196 -0
  135. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/compar.h +49 -0
  136. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/compile.h +35 -0
  137. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/compilers.h +107 -0
  138. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/complex.h +29 -0
  139. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/cont.h +24 -0
  140. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/dir.h +16 -0
  141. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/enc.h +19 -0
  142. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/encoding.h +30 -0
  143. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/enum.h +18 -0
  144. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/enumerator.h +21 -0
  145. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/error.h +191 -0
  146. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/eval.h +32 -0
  147. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/file.h +38 -0
  148. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/fixnum.h +184 -0
  149. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/gc.h +186 -0
  150. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/hash.h +243 -0
  151. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/imemo.h +243 -0
  152. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/inits.h +50 -0
  153. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/io.h +38 -0
  154. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/load.h +18 -0
  155. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/loadpath.h +16 -0
  156. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/math.h +23 -0
  157. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/missing.h +18 -0
  158. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/numeric.h +271 -0
  159. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/object.h +83 -0
  160. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/parse.h +23 -0
  161. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/proc.h +32 -0
  162. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/process.h +137 -0
  163. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/random.h +16 -0
  164. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/range.h +40 -0
  165. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/rational.h +72 -0
  166. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/re.h +30 -0
  167. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/sanitizers.h +190 -0
  168. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/serial.h +23 -0
  169. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/signal.h +21 -0
  170. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/static_assert.h +16 -0
  171. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/string.h +141 -0
  172. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/struct.h +153 -0
  173. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/symbol.h +41 -0
  174. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/thread.h +53 -0
  175. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/time.h +34 -0
  176. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/transcode.h +20 -0
  177. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/util.h +27 -0
  178. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/variable.h +83 -0
  179. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/vm.h +133 -0
  180. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal/warnings.h +16 -0
  181. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/internal.h +109 -0
  182. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/iseq.h +322 -0
  183. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/known_errors.inc +791 -0
  184. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/method.h +253 -0
  185. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/mjit.h +231 -0
  186. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/mjit_compile.inc +8322 -0
  187. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/node.h +510 -0
  188. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/node_name.inc +208 -0
  189. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/opt_sc.inc +109 -0
  190. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/optinsn.inc +128 -0
  191. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/optunifs.inc +43 -0
  192. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/parse.h +214 -0
  193. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/probes_helper.h +44 -0
  194. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ractor_core.h +346 -0
  195. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/regenc.h +254 -0
  196. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/regint.h +942 -0
  197. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/regparse.h +370 -0
  198. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/revision.h +2 -0
  199. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ruby_assert.h +14 -0
  200. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/ruby_atomic.h +23 -0
  201. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/siphash.h +48 -0
  202. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/symbol.h +119 -0
  203. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/thread_pthread.h +115 -0
  204. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/thread_win32.h +61 -0
  205. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/timev.h +57 -0
  206. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/transcode_data.h +138 -0
  207. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/transient_heap.h +65 -0
  208. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/variable.h +21 -0
  209. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/version.h +88 -0
  210. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/vm.inc +5470 -0
  211. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/vm_call_iseq_optimized.inc +244 -0
  212. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/vm_callinfo.h +487 -0
  213. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/vm_core.h +2107 -0
  214. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/vm_debug.h +124 -0
  215. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/vm_exec.h +197 -0
  216. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/vm_insnhelper.h +265 -0
  217. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/vm_opts.h +73 -0
  218. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/vm_sync.h +137 -0
  219. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/vmtc.inc +243 -0
  220. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/yjit.h +73 -0
  221. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/yjit_asm.h +408 -0
  222. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/yjit_codegen.h +23 -0
  223. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/yjit_core.h +307 -0
  224. data/lib/debase/ruby_core_source/ruby-3.1.0-p0/yjit_iface.h +38 -0
  225. data/lib/debase/ruby_core_source/version.rb +1 -1
  226. metadata +235 -14
@@ -0,0 +1,142 @@
1
+ /* CC0 (Public domain) - see ccan/licenses/CC0 file for details */
2
+ #ifndef CCAN_CONTAINER_OF_H
3
+ #define CCAN_CONTAINER_OF_H
4
+ #include "ccan/check_type/check_type.h"
5
+
6
+ /**
7
+ * container_of - get pointer to enclosing structure
8
+ * @member_ptr: pointer to the structure member
9
+ * @containing_type: the type this member is within
10
+ * @member: the name of this member within the structure.
11
+ *
12
+ * Given a pointer to a member of a structure, this macro does pointer
13
+ * subtraction to return the pointer to the enclosing type.
14
+ *
15
+ * Example:
16
+ * struct foo {
17
+ * int fielda, fieldb;
18
+ * // ...
19
+ * };
20
+ * struct info {
21
+ * int some_other_field;
22
+ * struct foo my_foo;
23
+ * };
24
+ *
25
+ * static struct info *foo_to_info(struct foo *foo)
26
+ * {
27
+ * return container_of(foo, struct info, my_foo);
28
+ * }
29
+ */
30
+ #define container_of(member_ptr, containing_type, member) \
31
+ ((containing_type *) \
32
+ ((char *)(member_ptr) \
33
+ - container_off(containing_type, member)) \
34
+ + check_types_match(*(member_ptr), ((containing_type *)0)->member))
35
+
36
+
37
+ /**
38
+ * container_of_or_null - get pointer to enclosing structure, or NULL
39
+ * @member_ptr: pointer to the structure member
40
+ * @containing_type: the type this member is within
41
+ * @member: the name of this member within the structure.
42
+ *
43
+ * Given a pointer to a member of a structure, this macro does pointer
44
+ * subtraction to return the pointer to the enclosing type, unless it
45
+ * is given NULL, in which case it also returns NULL.
46
+ *
47
+ * Example:
48
+ * struct foo {
49
+ * int fielda, fieldb;
50
+ * // ...
51
+ * };
52
+ * struct info {
53
+ * int some_other_field;
54
+ * struct foo my_foo;
55
+ * };
56
+ *
57
+ * static struct info *foo_to_info_allowing_null(struct foo *foo)
58
+ * {
59
+ * return container_of_or_null(foo, struct info, my_foo);
60
+ * }
61
+ */
62
+ static inline char *container_of_or_null_(void *member_ptr, size_t offset)
63
+ {
64
+ return member_ptr ? (char *)member_ptr - offset : NULL;
65
+ }
66
+ #define container_of_or_null(member_ptr, containing_type, member) \
67
+ ((containing_type *) \
68
+ container_of_or_null_(member_ptr, \
69
+ container_off(containing_type, member)) \
70
+ + check_types_match(*(member_ptr), ((containing_type *)0)->member))
71
+
72
+ /**
73
+ * container_off - get offset to enclosing structure
74
+ * @containing_type: the type this member is within
75
+ * @member: the name of this member within the structure.
76
+ *
77
+ * Given a pointer to a member of a structure, this macro does
78
+ * typechecking and figures out the offset to the enclosing type.
79
+ *
80
+ * Example:
81
+ * struct foo {
82
+ * int fielda, fieldb;
83
+ * // ...
84
+ * };
85
+ * struct info {
86
+ * int some_other_field;
87
+ * struct foo my_foo;
88
+ * };
89
+ *
90
+ * static struct info *foo_to_info(struct foo *foo)
91
+ * {
92
+ * size_t off = container_off(struct info, my_foo);
93
+ * return (void *)((char *)foo - off);
94
+ * }
95
+ */
96
+ #define container_off(containing_type, member) \
97
+ offsetof(containing_type, member)
98
+
99
+ /**
100
+ * container_of_var - get pointer to enclosing structure using a variable
101
+ * @member_ptr: pointer to the structure member
102
+ * @container_var: a pointer of same type as this member's container
103
+ * @member: the name of this member within the structure.
104
+ *
105
+ * Given a pointer to a member of a structure, this macro does pointer
106
+ * subtraction to return the pointer to the enclosing type.
107
+ *
108
+ * Example:
109
+ * static struct info *foo_to_i(struct foo *foo)
110
+ * {
111
+ * struct info *i = container_of_var(foo, i, my_foo);
112
+ * return i;
113
+ * }
114
+ */
115
+ #if HAVE_TYPEOF
116
+ #define container_of_var(member_ptr, container_var, member) \
117
+ container_of(member_ptr, typeof(*container_var), member)
118
+ #else
119
+ #define container_of_var(member_ptr, container_var, member) \
120
+ ((void *)((char *)(member_ptr) - \
121
+ container_off_var(container_var, member)))
122
+ #endif
123
+
124
+ /**
125
+ * container_off_var - get offset of a field in enclosing structure
126
+ * @container_var: a pointer to a container structure
127
+ * @member: the name of a member within the structure.
128
+ *
129
+ * Given (any) pointer to a structure and a its member name, this
130
+ * macro does pointer subtraction to return offset of member in a
131
+ * structure memory layout.
132
+ *
133
+ */
134
+ #if HAVE_TYPEOF
135
+ #define container_off_var(var, member) \
136
+ container_off(typeof(*var), member)
137
+ #else
138
+ #define container_off_var(var, member) \
139
+ ((const char *)&(var)->member - (const char *)(var))
140
+ #endif
141
+
142
+ #endif /* CCAN_CONTAINER_OF_H */