Merge branch '2227-more-nullables' into 'master'

glib: Add more missing return value annotations

See merge request GNOME/glib!1801
This commit is contained in:
Sebastian Dröge 2020-12-15 08:22:00 +00:00
commit 784f968895
4 changed files with 25 additions and 23 deletions

View File

@ -1421,8 +1421,8 @@ g_ptr_array_unref (GPtrArray *array)
* threads, use only the atomic g_ptr_array_ref() and g_ptr_array_unref() * threads, use only the atomic g_ptr_array_ref() and g_ptr_array_unref()
* functions. * functions.
* *
* Returns: the pointer array if @free_seg is %FALSE, otherwise %NULL. * Returns: (transfer full) (nullable): the pointer array if @free_seg is
* The pointer array should be freed using g_free(). * %FALSE, otherwise %NULL. The pointer array should be freed using g_free().
*/ */
gpointer* gpointer*
g_ptr_array_free (GPtrArray *array, g_ptr_array_free (GPtrArray *array,

View File

@ -482,7 +482,7 @@ g_async_queue_pop_unlocked (GAsyncQueue *queue)
* Tries to pop data from the @queue. If no data is available, * Tries to pop data from the @queue. If no data is available,
* %NULL is returned. * %NULL is returned.
* *
* Returns: data from the queue or %NULL, when no data is * Returns: (nullable): data from the queue or %NULL, when no data is
* available immediately. * available immediately.
*/ */
gpointer gpointer
@ -508,7 +508,7 @@ g_async_queue_try_pop (GAsyncQueue *queue)
* *
* This function must be called while holding the @queue's lock. * This function must be called while holding the @queue's lock.
* *
* Returns: data from the queue or %NULL, when no data is * Returns: (nullable): data from the queue or %NULL, when no data is
* available immediately. * available immediately.
*/ */
gpointer gpointer
@ -529,7 +529,7 @@ g_async_queue_try_pop_unlocked (GAsyncQueue *queue)
* *
* If no data is received before the timeout, %NULL is returned. * If no data is received before the timeout, %NULL is returned.
* *
* Returns: data from the queue or %NULL, when no data is * Returns: (nullable): data from the queue or %NULL, when no data is
* received before the timeout. * received before the timeout.
*/ */
gpointer gpointer
@ -560,7 +560,7 @@ g_async_queue_timeout_pop (GAsyncQueue *queue,
* *
* This function must be called while holding the @queue's lock. * This function must be called while holding the @queue's lock.
* *
* Returns: data from the queue or %NULL, when no data is * Returns: (nullable): data from the queue or %NULL, when no data is
* received before the timeout. * received before the timeout.
*/ */
gpointer gpointer
@ -587,7 +587,7 @@ g_async_queue_timeout_pop_unlocked (GAsyncQueue *queue,
* To easily calculate @end_time, a combination of g_get_real_time() * To easily calculate @end_time, a combination of g_get_real_time()
* and g_time_val_add() can be used. * and g_time_val_add() can be used.
* *
* Returns: data from the queue or %NULL, when no data is * Returns: (nullable): data from the queue or %NULL, when no data is
* received before @end_time. * received before @end_time.
* *
* Deprecated: use g_async_queue_timeout_pop(). * Deprecated: use g_async_queue_timeout_pop().
@ -633,7 +633,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* *
* This function must be called while holding the @queue's lock. * This function must be called while holding the @queue's lock.
* *
* Returns: data from the queue or %NULL, when no data is * Returns: (nullable): data from the queue or %NULL, when no data is
* received before @end_time. * received before @end_time.
* *
* Deprecated: use g_async_queue_timeout_pop_unlocked(). * Deprecated: use g_async_queue_timeout_pop_unlocked().

View File

@ -1923,7 +1923,7 @@ g_bookmark_file_load_from_data_dirs (GBookmarkFile *bookmark,
* *
* This function outputs @bookmark as a string. * This function outputs @bookmark as a string.
* *
* Returns: (array length=length) (element-type guint8): * Returns: (transfer full) (array length=length) (element-type guint8):
* a newly allocated string holding the contents of the #GBookmarkFile * a newly allocated string holding the contents of the #GBookmarkFile
* *
* Since: 2.12 * Since: 2.12
@ -2210,7 +2210,7 @@ g_bookmark_file_set_title (GBookmarkFile *bookmark,
* In the event the URI cannot be found, %NULL is returned and * In the event the URI cannot be found, %NULL is returned and
* @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
* *
* Returns: a newly allocated string or %NULL if the specified * Returns: (transfer full): a newly allocated string or %NULL if the specified
* URI cannot be found. * URI cannot be found.
* *
* Since: 2.12 * Since: 2.12
@ -2295,7 +2295,7 @@ g_bookmark_file_set_description (GBookmarkFile *bookmark,
* In the event the URI cannot be found, %NULL is returned and * In the event the URI cannot be found, %NULL is returned and
* @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. * @error is set to #G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND.
* *
* Returns: a newly allocated string or %NULL if the specified * Returns: (transfer full): a newly allocated string or %NULL if the specified
* URI cannot be found. * URI cannot be found.
* *
* Since: 2.12 * Since: 2.12
@ -2377,7 +2377,7 @@ g_bookmark_file_set_mime_type (GBookmarkFile *bookmark,
* event that the MIME type cannot be found, %NULL is returned and * event that the MIME type cannot be found, %NULL is returned and
* @error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE. * @error is set to #G_BOOKMARK_FILE_ERROR_INVALID_VALUE.
* *
* Returns: a newly allocated string or %NULL if the specified * Returns: (transfer full): a newly allocated string or %NULL if the specified
* URI cannot be found. * URI cannot be found.
* *
* Since: 2.12 * Since: 2.12

View File

@ -1461,7 +1461,7 @@ g_checksum_type_get_length (GChecksumType checksum_type)
* will be closed and it won't be possible to call g_checksum_update() * will be closed and it won't be possible to call g_checksum_update()
* on it anymore. * on it anymore.
* *
* Returns: (transfer full): the newly created #GChecksum, or %NULL. * Returns: (transfer full) (nullable): the newly created #GChecksum, or %NULL.
* Use g_checksum_free() to free the memory allocated by it. * Use g_checksum_free() to free the memory allocated by it.
* *
* Since: 2.16 * Since: 2.16
@ -1529,8 +1529,8 @@ g_checksum_reset (GChecksum *checksum)
* g_checksum_get_string() or g_checksum_get_digest(), the copied * g_checksum_get_string() or g_checksum_get_digest(), the copied
* checksum will be closed as well. * checksum will be closed as well.
* *
* Returns: the copy of the passed #GChecksum. Use g_checksum_free() * Returns: (transfer full): the copy of the passed #GChecksum. Use
* when finished using it. * g_checksum_free() when finished using it.
* *
* Since: 2.16 * Since: 2.16
*/ */
@ -1775,8 +1775,10 @@ g_checksum_get_digest (GChecksum *checksum,
* *
* The hexadecimal string returned will be in lower case. * The hexadecimal string returned will be in lower case.
* *
* Returns: the digest of the binary data as a string in hexadecimal. * Returns: (transfer full) (nullable): the digest of the binary data as a
* The returned string should be freed with g_free() when done using it. * string in hexadecimal, or %NULL if g_checksum_new() fails for
* @checksum_type. The returned string should be freed with g_free() when
* done using it.
* *
* Since: 2.16 * Since: 2.16
*/ */
@ -1788,7 +1790,6 @@ g_compute_checksum_for_data (GChecksumType checksum_type,
GChecksum *checksum; GChecksum *checksum;
gchar *retval; gchar *retval;
g_return_val_if_fail (IS_VALID_TYPE (checksum_type), NULL);
g_return_val_if_fail (length == 0 || data != NULL, NULL); g_return_val_if_fail (length == 0 || data != NULL, NULL);
checksum = g_checksum_new (checksum_type); checksum = g_checksum_new (checksum_type);
@ -1812,7 +1813,8 @@ g_compute_checksum_for_data (GChecksumType checksum_type,
* *
* The hexadecimal string returned will be in lower case. * The hexadecimal string returned will be in lower case.
* *
* Returns: the checksum as a hexadecimal string. The returned string * Returns: (transfer full) (nullable): the checksum as a hexadecimal string,
* or %NULL if g_checksum_new() fails for @checksum_type. The returned string
* should be freed with g_free() when done using it. * should be freed with g_free() when done using it.
* *
* Since: 2.16 * Since: 2.16
@ -1822,7 +1824,6 @@ g_compute_checksum_for_string (GChecksumType checksum_type,
const gchar *str, const gchar *str,
gssize length) gssize length)
{ {
g_return_val_if_fail (IS_VALID_TYPE (checksum_type), NULL);
g_return_val_if_fail (length == 0 || str != NULL, NULL); g_return_val_if_fail (length == 0 || str != NULL, NULL);
if (length < 0) if (length < 0)
@ -1842,8 +1843,10 @@ g_compute_checksum_for_string (GChecksumType checksum_type,
* *
* The hexadecimal string returned will be in lower case. * The hexadecimal string returned will be in lower case.
* *
* Returns: the digest of the binary data as a string in hexadecimal. * Returns: (transfer full) (nullable): the digest of the binary data as a
* The returned string should be freed with g_free() when done using it. * string in hexadecimal, or %NULL if g_checksum_new() fails for
* @checksum_type. The returned string should be freed with g_free() when
* done using it.
* *
* Since: 2.34 * Since: 2.34
*/ */
@ -1854,7 +1857,6 @@ g_compute_checksum_for_bytes (GChecksumType checksum_type,
gconstpointer byte_data; gconstpointer byte_data;
gsize length; gsize length;
g_return_val_if_fail (IS_VALID_TYPE (checksum_type), NULL);
g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
byte_data = g_bytes_get_data (data, &length); byte_data = g_bytes_get_data (data, &length);