Commit d238669e authored by Jeffrey Stedfast's avatar Jeffrey Stedfast Committed by Jeffrey Stedfast

New function to reset the state of a GChecksum. (g_checksum_new): Call

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.


svn path=/trunk/; revision=6903
parent a30f8df3
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.
2008-05-17 Matthias Clasen <mclasen@redhat.com>
Bug 528667 – Typos in testing module documentation
......@@ -45,6 +52,7 @@
* glib/gi18n.c: #include <locale.h> to fix the build.
>>>>>>> .r6902
2008-05-12 Yair Hershkovitz <yairhr@gmail.com>
* glib/gi18n.c (g_i18n_init): Coding convention fix. Space between
......
......@@ -1114,7 +1114,24 @@ g_checksum_new (GChecksumType checksum_type)
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_checksum_new (GChecksumType checksum_type)
g_assert_not_reached ();
break;
}
return checksum;
}
/**
......
......@@ -54,6 +54,7 @@ typedef struct _GChecksum GChecksum;
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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment