* garrow_buffer_get_mutable_data: * @buffer: A #GArrowBuffer. * * Returns: (transfer full) (nullable): The data of the buffer. If the * buffer is immutable, it returns %NULL. The data is owned by the * buffer. You should not free the data. * * Since: 0.3.0 */
| 311 | * Since: 0.3.0 |
| 312 | */ |
| 313 | GBytes * |
| 314 | garrow_buffer_get_mutable_data(GArrowBuffer *buffer) |
| 315 | { |
| 316 | auto arrow_buffer = garrow_buffer_get_raw(buffer); |
| 317 | if (!arrow_buffer->is_mutable()) { |
| 318 | return NULL; |
| 319 | } |
| 320 | |
| 321 | auto priv = GARROW_BUFFER_GET_PRIVATE(buffer); |
| 322 | if (priv->data) { |
| 323 | g_bytes_ref(priv->data); |
| 324 | return priv->data; |
| 325 | } |
| 326 | |
| 327 | return g_bytes_new_static(arrow_buffer->mutable_data(), arrow_buffer->size()); |
| 328 | } |
| 329 | |
| 330 | /** |
| 331 | * garrow_buffer_get_size: |
nothing calls this directly
no test coverage detected