[glib: 6/7] gchecksum: Drop preconditions for checksum_type being valid




commit 0755ff97be198e0e255141f99776320fa6c1e893
Author: Philip Withnall <pwithnall endlessos org>
Date:   Sat Dec 12 18:28:45 2020 +0000

    gchecksum: Drop preconditions for checksum_type being valid
    
    Instead, return `NULL` if the checksum type is unsupported. This may
    come in useful if we have to withdraw support for a particular checksum
    type in future, due to it being broken.
    
    These semantics were already in place for the return value of
    `g_checksum_new()` — see commit 877cc60f and bug
    comment https://bugzilla.gnome.org/show_bug.cgi?id=501853#c6.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/gchecksum.c | 3 ---
 1 file changed, 3 deletions(-)
---
diff --git a/glib/gchecksum.c b/glib/gchecksum.c
index f5ef9a443..29b479bc6 100644
--- a/glib/gchecksum.c
+++ b/glib/gchecksum.c
@@ -1790,7 +1790,6 @@ g_compute_checksum_for_data (GChecksumType  checksum_type,
   GChecksum *checksum;
   gchar *retval;
 
-  g_return_val_if_fail (IS_VALID_TYPE (checksum_type), NULL);
   g_return_val_if_fail (length == 0 || data != NULL, NULL);
 
   checksum = g_checksum_new (checksum_type);
@@ -1825,7 +1824,6 @@ g_compute_checksum_for_string (GChecksumType  checksum_type,
                                const gchar   *str,
                                gssize         length)
 {
-  g_return_val_if_fail (IS_VALID_TYPE (checksum_type), NULL);
   g_return_val_if_fail (length == 0 || str != NULL, NULL);
 
   if (length < 0)
@@ -1859,7 +1857,6 @@ g_compute_checksum_for_bytes (GChecksumType  checksum_type,
   gconstpointer byte_data;
   gsize length;
 
-  g_return_val_if_fail (IS_VALID_TYPE (checksum_type), NULL);
   g_return_val_if_fail (data != NULL, NULL);
 
   byte_data = g_bytes_get_data (data, &length);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]