File ruby-1.8.x_digest_non_void_return.patch of Package ruby.import4584

Index: ext/digest/digest.c
===================================================================
--- ext/digest/digest.c.orig	2009-12-14 04:19:26.000000000 +0100
+++ ext/digest/digest.c	2010-02-23 12:27:54.812092205 +0100
@@ -2,14 +2,14 @@
 
   digest.c -
 
-  $Author: shyouhei $
+  $Author: knu $
   created at: Fri May 25 08:57:27 JST 2001
 
   Copyright (C) 1995-2001 Yukihiro Matsumoto
   Copyright (C) 2001-2006 Akinori MUSHA
 
   $RoughId: digest.c,v 1.16 2001/07/13 15:38:27 knu Exp $
-  $Id: digest.c 26089 2009-12-14 03:19:26Z shyouhei $
+  $Id: digest.c 26341 2010-01-17 19:23:17Z knu $
 
 ************************************************/
 
@@ -76,6 +76,8 @@ rb_digest_s_hexencode(VALUE klass, VALUE
     return hexencode_str_new(str);
 }
 
+NORETURN(static void rb_digest_instance_method_unimpl(VALUE self, const char *method));
+
 /*
  * Document-module: Digest::Instance
  *
@@ -86,8 +88,6 @@ rb_digest_s_hexencode(VALUE klass, VALUE
 static void
 rb_digest_instance_method_unimpl(VALUE self, const char *method)
 {
-    VALUE klass = rb_obj_class(self);
-
     rb_raise(rb_eRuntimeError, "%s does not implement %s()",
 	     rb_obj_classname(self), method);
 }
@@ -179,10 +179,7 @@ rb_digest_instance_digest(int argc, VALU
         value = rb_funcall(self, id_finish, 0);
         rb_funcall(self, id_reset, 0);
     } else {
-        VALUE clone = rb_obj_clone(self);
-
-        value = rb_funcall(clone, id_finish, 0);
-        rb_funcall(clone, id_reset, 0);
+        value = rb_funcall(rb_obj_clone(self), id_finish, 0);
     }
 
     return value;
@@ -227,10 +224,7 @@ rb_digest_instance_hexdigest(int argc, V
         value = rb_funcall(self, id_finish, 0);
         rb_funcall(self, id_reset, 0);
     } else {
-        VALUE clone = rb_obj_clone(self);
-
-        value = rb_funcall(clone, id_finish, 0);
-        rb_funcall(clone, id_reset, 0);
+        value = rb_funcall(rb_obj_clone(self), id_finish, 0);
     }
 
     return hexencode_str_new(value);
@@ -240,8 +234,8 @@ rb_digest_instance_hexdigest(int argc, V
  * call-seq:
  *     digest_obj.hexdigest! -> string
  *
- * Returns the resulting hash value and resets the digest to the
- * initial state.
+ * Returns the resulting hash value in a hex-encoded form and resets
+ * the digest to the initial state.
  */
 static VALUE
 rb_digest_instance_hexdigest_bang(VALUE self)
@@ -275,7 +269,7 @@ rb_digest_instance_inspect(VALUE self)
 {
     VALUE str;
     size_t digest_len = 32;	/* about this size at least */
-    char *cname;
+    const char *cname;
 
     cname = rb_obj_classname(self);