glib r6903 - in trunk: . glib
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r6903 - in trunk: . glib
- Date: Sat, 17 May 2008 16:53:55 +0000 (UTC)
Author: fejj
Date: Sat May 17 16:53:54 2008
New Revision: 6903
URL: http://svn.gnome.org/viewvc/glib?rev=6903&view=rev
Log:
2008-05-12 Jeffrey Stedfast <fejj novell com>
* glib/gchecksum.c (g_checksum_reset): New function to reset the
state of a GChecksum.
(g_checksum_new): Call g_checksum_reset() instead of duplicating
code.
Modified:
trunk/ChangeLog
trunk/glib/gchecksum.c
trunk/glib/gchecksum.h
Modified: trunk/glib/gchecksum.c
==============================================================================
--- trunk/glib/gchecksum.c (original)
+++ trunk/glib/gchecksum.c Sat May 17 16:53:54 2008
@@ -1114,7 +1114,24 @@
checksum = g_slice_new0 (GChecksum);
checksum->type = checksum_type;
- switch (checksum_type)
+ g_checksum_reset (checksum);
+
+ return checksum;
+}
+
+/**
+ * g_checksum_reset:
+ * @checksum: the #GChecksum to reset
+ *
+ * Resets the state of the @checksum back to it's initial state.
+ **/
+void
+g_checksum_reset (GChecksum *checksum)
+{
+ g_free (checksum->digest_str);
+ checksum->digest_str = NULL;
+
+ switch (checksum->type)
{
case G_CHECKSUM_MD5:
md5_sum_init (&(checksum->sum.md5));
@@ -1129,8 +1146,6 @@
g_assert_not_reached ();
break;
}
-
- return checksum;
}
/**
Modified: trunk/glib/gchecksum.h
==============================================================================
--- trunk/glib/gchecksum.h (original)
+++ trunk/glib/gchecksum.h Sat May 17 16:53:54 2008
@@ -54,6 +54,7 @@
gssize g_checksum_type_get_length (GChecksumType checksum_type);
GChecksum * g_checksum_new (GChecksumType checksum_type);
+void g_checksum_reset (GChecksum *checksum);
GChecksum * g_checksum_copy (const GChecksum *checksum);
void g_checksum_free (GChecksum *checksum);
void g_checksum_update (GChecksum *checksum,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]