From 6cee1e53d3a95cccdba3b8288049862e9ffac6e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Thu, 31 Jul 2008 12:29:56 +0200
Subject: [PATCH] Improved diagnostics.

Rev: src/encode.c:1.284
---
 src/encode.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/encode.c b/src/encode.c
index cb6b7293d7..3ab6097f81 100644
--- a/src/encode.c
+++ b/src/encode.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: encode.c,v 1.283 2008/06/29 12:50:03 nilsson Exp $
+|| $Id: encode.c,v 1.284 2008/07/31 10:29:56 grubba Exp $
 */
 
 #include "global.h"
@@ -2495,9 +2495,10 @@ static DECLSPEC(noreturn) void decode_error (struct svalue *decoding,
   }
   push_text (buf); n++;
   if (other) {
-    push_constant_text ("%O\n");
+    push_constant_text ("%O (%t)\n");
     push_svalue (other);
-    f_sprintf (2); n++;
+    push_text(get_name_of_type(other->type));
+    f_sprintf (3); n++;
   }
   f_add (n);
 
@@ -3017,6 +3018,7 @@ static void decode_value2(struct decode_data *data)
 
     case TAG_FUNCTION:
       decode_value2(data);
+      stack_dup();	/* For diagnostic purposes... */
 
       switch(num)
       {
@@ -3075,7 +3077,10 @@ static void decode_value2(struct decode_data *data)
       }
 
       if(Pike_sp[-1].type != T_FUNCTION && data->pickyness)
-	decode_error(NULL, Pike_sp - 1, "Failed to decode function. Got: ");
+	decode_error(Pike_sp - 2, Pike_sp - 1,
+		     "Failed to decode function. Got: ");
+
+      stack_pop_keep_top();
 
       break;
 
-- 
GitLab