From 3a1bef89e90d97710cf2d9534ec0c37afe6f5cda Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Sun, 7 Jun 1998 21:47:53 +0200
Subject: [PATCH] Added support for program_from_svalue() to index_no_free().

Rev: src/opcodes.c:1.28
---
 src/opcodes.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/opcodes.c b/src/opcodes.c
index fbc4da4850..623bf21372 100644
--- a/src/opcodes.c
+++ b/src/opcodes.c
@@ -22,7 +22,7 @@
 #include "builtin_functions.h"
 #include "module_support.h"
 
-RCSID("$Id: opcodes.c,v 1.27 1998/05/25 20:47:47 marcus Exp $");
+RCSID("$Id: opcodes.c,v 1.28 1998/06/07 19:47:53 grubba Exp $");
 
 void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)
 {
@@ -48,10 +48,6 @@ void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)
     to->u.integer=i;
     break;
 
-  case T_PROGRAM:
-    program_index_no_free(to, what->u.program, ind);
-    break;
-
   case T_STRING:
     if(ind->type==T_INT)
     {
@@ -70,6 +66,20 @@ void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)
       error("Index is not an integer.\n");
     }
 
+  case T_PROGRAM:
+    program_index_no_free(to, what->u.program, ind);
+    break;
+
+  case T_FUNCTION:
+    {
+      struct program *p = program_from_svalue(what);
+      if (p) {
+	program_index_no_free(to, p, ind);
+	break;
+      }
+    }
+    /* FALL THROUGH */
+
   default:
     error("Indexing a basic type.\n");
   }
-- 
GitLab