pw_allocator: Use move-semantics for Block API

Several Block methods consume a block pointer and return a replacement.
Previously, this was accomplished by having static methods that took an
l-value reference to a Block pointer that was modified in place.

It was noted in pwrev/235312 that this API is potentially confusing, and
recommended consuming the pointers as rvalue references and returning
new pointers. This makes it clearer when a pointer is being consumed,
and allows the compiler to catch bugs like using a moved-from pointer.

Change-Id: I7b8d51da58b7a7195e43d840871b31d5f965d84c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/242633
Docs-Not-Needed: Aaron Green <aarongreen@google.com>
Commit-Queue: Aaron Green <aarongreen@google.com>
Reviewed-by: Taylor Cramer <cramertj@google.com>
Pigweed-Auto-Submit: Aaron Green <aarongreen@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
30 files changed
tree: 639873e2878071a8b8886441a1a481aaaaf92bcd
  1. .allstar/
  2. .github/
  3. .vscode/
  4. build_overrides/
  5. docker/
  6. docs/
  7. kudzu/
  8. pw_alignment/
  9. pw_allocator/
  10. pw_analog/
  11. pw_android_toolchain/
  12. pw_arduino_build/
  13. pw_assert/
  14. pw_assert_basic/
  15. pw_assert_fuchsia/
  16. pw_assert_log/
  17. pw_assert_tokenized/
  18. pw_assert_trap/
  19. pw_assert_zephyr/
  20. pw_async/
  21. pw_async2/
  22. pw_async2_basic/
  23. pw_async2_epoll/
  24. pw_async_basic/
  25. pw_async_fuchsia/
  26. pw_base64/
  27. pw_bloat/
  28. pw_blob_store/
  29. pw_bluetooth/
  30. pw_bluetooth_hci/
  31. pw_bluetooth_profiles/
  32. pw_bluetooth_proxy/
  33. pw_bluetooth_sapphire/
  34. pw_boot/
  35. pw_boot_cortex_m/
  36. pw_build/
  37. pw_build_android/
  38. pw_build_info/
  39. pw_build_mcuxpresso/
  40. pw_bytes/
  41. pw_channel/
  42. pw_checksum/
  43. pw_chre/
  44. pw_chrono/
  45. pw_chrono_embos/
  46. pw_chrono_freertos/
  47. pw_chrono_rp2040/
  48. pw_chrono_stl/
  49. pw_chrono_threadx/
  50. pw_chrono_zephyr/
  51. pw_cli/
  52. pw_cli_analytics/
  53. pw_clock_tree/
  54. pw_clock_tree_mcuxpresso/
  55. pw_compilation_testing/
  56. pw_config_loader/
  57. pw_console/
  58. pw_containers/
  59. pw_cpu_exception/
  60. pw_cpu_exception_cortex_m/
  61. pw_cpu_exception_risc_v/
  62. pw_crypto/
  63. pw_digital_io/
  64. pw_digital_io_linux/
  65. pw_digital_io_mcuxpresso/
  66. pw_digital_io_rp2040/
  67. pw_display/
  68. pw_dma_mcuxpresso/
  69. pw_docgen/
  70. pw_doctor/
  71. pw_elf/
  72. pw_emu/
  73. pw_env_setup/
  74. pw_env_setup_zephyr/
  75. pw_file/
  76. pw_format/
  77. pw_function/
  78. pw_fuzzer/
  79. pw_grpc/
  80. pw_hdlc/
  81. pw_hex_dump/
  82. pw_i2c/
  83. pw_i2c_linux/
  84. pw_i2c_mcuxpresso/
  85. pw_i2c_rp2040/
  86. pw_ide/
  87. pw_interrupt/
  88. pw_interrupt_cortex_m/
  89. pw_interrupt_xtensa/
  90. pw_interrupt_zephyr/
  91. pw_intrusive_ptr/
  92. pw_json/
  93. pw_kvs/
  94. pw_libc/
  95. pw_libcxx/
  96. pw_log/
  97. pw_log_android/
  98. pw_log_basic/
  99. pw_log_fuchsia/
  100. pw_log_null/
  101. pw_log_rpc/
  102. pw_log_string/
  103. pw_log_tokenized/
  104. pw_log_zephyr/
  105. pw_malloc/
  106. pw_malloc_freelist/
  107. pw_malloc_freertos/
  108. pw_metric/
  109. pw_minimal_cpp_stdlib/
  110. pw_module/
  111. pw_multibuf/
  112. pw_multisink/
  113. pw_numeric/
  114. pw_package/
  115. pw_perf_test/
  116. pw_persistent_ram/
  117. pw_polyfill/
  118. pw_preprocessor/
  119. pw_presubmit/
  120. pw_protobuf/
  121. pw_protobuf_compiler/
  122. pw_random/
  123. pw_random_fuchsia/
  124. pw_result/
  125. pw_ring_buffer/
  126. pw_router/
  127. pw_rpc/
  128. pw_rpc_transport/
  129. pw_rust/
  130. pw_sensor/
  131. pw_snapshot/
  132. pw_software_update/
  133. pw_span/
  134. pw_spi/
  135. pw_spi_linux/
  136. pw_spi_mcuxpresso/
  137. pw_spi_rp2040/
  138. pw_status/
  139. pw_stm32cube_build/
  140. pw_stream/
  141. pw_stream_shmem_mcuxpresso/
  142. pw_stream_uart_linux/
  143. pw_stream_uart_mcuxpresso/
  144. pw_string/
  145. pw_symbolizer/
  146. pw_sync/
  147. pw_sync_baremetal/
  148. pw_sync_embos/
  149. pw_sync_freertos/
  150. pw_sync_stl/
  151. pw_sync_threadx/
  152. pw_sync_zephyr/
  153. pw_sys_io/
  154. pw_sys_io_ambiq_sdk/
  155. pw_sys_io_arduino/
  156. pw_sys_io_baremetal_lm3s6965evb/
  157. pw_sys_io_baremetal_stm32f429/
  158. pw_sys_io_emcraft_sf2/
  159. pw_sys_io_mcuxpresso/
  160. pw_sys_io_rp2040/
  161. pw_sys_io_stdio/
  162. pw_sys_io_stm32cube/
  163. pw_sys_io_zephyr/
  164. pw_system/
  165. pw_target_runner/
  166. pw_thread/
  167. pw_thread_embos/
  168. pw_thread_freertos/
  169. pw_thread_stl/
  170. pw_thread_threadx/
  171. pw_thread_zephyr/
  172. pw_tls_client/
  173. pw_tls_client_boringssl/
  174. pw_tls_client_mbedtls/
  175. pw_tokenizer/
  176. pw_toolchain/
  177. pw_toolchain_bazel/
  178. pw_trace/
  179. pw_trace_tokenized/
  180. pw_transfer/
  181. pw_uart/
  182. pw_uart_mcuxpresso/
  183. pw_unit_test/
  184. pw_unit_test_zephyr/
  185. pw_varint/
  186. pw_watch/
  187. pw_web/
  188. pw_work_queue/
  189. seed/
  190. targets/
  191. third_party/
  192. ts/
  193. zephyr/
  194. .bazelignore
  195. .bazelrc
  196. .bazelversion
  197. .black.toml
  198. .clang-format
  199. .clang-tidy
  200. .eslintrc.cjs
  201. .git-blame-ignore-revs
  202. .gitattributes
  203. .gitignore
  204. .gn
  205. .mypy.ini
  206. .prettierignore
  207. .prettierrc.cjs
  208. .pw_ide.yaml
  209. .pylintrc
  210. .ruff.toml
  211. activate.bat
  212. Android.bp
  213. AUTHORS
  214. bootstrap.bat
  215. bootstrap.fish
  216. bootstrap.sh
  217. BUILD.bazel
  218. BUILD.gn
  219. BUILDCONFIG.gn
  220. CMakeLists.txt
  221. go.mod
  222. go.sum
  223. jest.config.ts
  224. Kconfig.zephyr
  225. LICENSE
  226. MODULE.bazel
  227. MODULE.bazel.lock
  228. modules.gni
  229. OWNERS
  230. package-lock.json
  231. package.json
  232. pigweed.json
  233. PIGWEED_MODULES
  234. README.md
  235. rollup-protos.config.js
  236. rollup.config.js
  237. tsconfig.json
  238. WORKSPACE
  239. WORKSPACE_OWNERS
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links