gslice: Mark memory arguments and return values as nullable when it's the case

GSlice can handle NULL arguments or return NULL values, but we did not
properly mark them all the times.
This commit is contained in:
Marco Trevisan (Treviño) 2023-02-03 16:24:18 +01:00
parent 6af6f3eb9b
commit 893b86b939

View File

@ -188,7 +188,7 @@ g_slice_get_config_state (GSliceConfig ckey,
/** /**
* g_slice_free: * g_slice_free:
* @type: the type of the block to free, typically a structure name * @type: the type of the block to free, typically a structure name
* @mem: a pointer to the block to free * @mem: (nullable): a pointer to the block to free
* *
* A convenience macro to free a block of memory that has * A convenience macro to free a block of memory that has
* been allocated from the slice allocator. * been allocated from the slice allocator.
@ -208,7 +208,7 @@ g_slice_get_config_state (GSliceConfig ckey,
/** /**
* g_slice_free_chain: * g_slice_free_chain:
* @type: the type of the @mem_chain blocks * @type: the type of the @mem_chain blocks
* @mem_chain: a pointer to the first block of the chain * @mem_chain: (nullable): a pointer to the first block of the chain
* @next: the field name of the next pointer in @type * @next: the field name of the next pointer in @type
* *
* Frees a linked list of memory blocks of structure type @type. * Frees a linked list of memory blocks of structure type @type.
@ -239,7 +239,7 @@ g_slice_get_config_state (GSliceConfig ckey,
* Since GLib 2.76 this always uses the system malloc() implementation * Since GLib 2.76 this always uses the system malloc() implementation
* internally. * internally.
* *
* Returns: a pointer to the allocated memory block, which will * Returns: (nullable): a pointer to the allocated memory block, which will
* be %NULL if and only if @mem_size is 0 * be %NULL if and only if @mem_size is 0
* *
* Since: 2.10 * Since: 2.10
@ -265,8 +265,8 @@ g_slice_alloc (gsize mem_size)
* Since GLib 2.76 this always uses the system malloc() implementation * Since GLib 2.76 this always uses the system malloc() implementation
* internally. * internally.
* *
* Returns: a pointer to the allocated block, which will be %NULL if and only * Returns: (nullable): a pointer to the allocated block, which will be %NULL
* if @mem_size is 0 * if and only if @mem_size is 0
* *
* Since: 2.10 * Since: 2.10
*/ */
@ -292,8 +292,8 @@ g_slice_alloc0 (gsize mem_size)
* Since GLib 2.76 this always uses the system malloc() implementation * Since GLib 2.76 this always uses the system malloc() implementation
* internally. * internally.
* *
* Returns: a pointer to the allocated memory block, which will be %NULL if and * Returns: (nullable): a pointer to the allocated memory block,
* only if @mem_size is 0 * which will be %NULL if and only if @mem_size is 0
* *
* Since: 2.14 * Since: 2.14
*/ */
@ -310,7 +310,7 @@ g_slice_copy (gsize mem_size,
/** /**
* g_slice_free1: * g_slice_free1:
* @block_size: the size of the block * @block_size: the size of the block
* @mem_block: a pointer to the block to free * @mem_block: (nullable): a pointer to the block to free
* *
* Frees a block of memory. * Frees a block of memory.
* *
@ -340,7 +340,7 @@ g_slice_free1 (gsize mem_size,
/** /**
* g_slice_free_chain_with_offset: * g_slice_free_chain_with_offset:
* @block_size: the size of the blocks * @block_size: the size of the blocks
* @mem_chain: a pointer to the first block of the chain * @mem_chain: (nullable): a pointer to the first block of the chain
* @next_offset: the offset of the @next field in the blocks * @next_offset: the offset of the @next field in the blocks
* *
* Frees a linked list of memory blocks of structure type @type. * Frees a linked list of memory blocks of structure type @type.