From 781d7cbe22fc56449cff21d5b67983e516f39a5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Mon, 14 Apr 2008 12:05:14 +0200
Subject: [PATCH] Detection of subtyped objects.

Rev: src/module_support.c:1.73
---
 src/module_support.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/module_support.c b/src/module_support.c
index 5ade002b27..446c4ee020 100644
--- a/src/module_support.c
+++ b/src/module_support.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: module_support.c,v 1.72 2008/04/01 08:02:10 mast Exp $
+|| $Id: module_support.c,v 1.73 2008/04/14 10:05:14 grubba Exp $
 */
 
 #include "global.h"
@@ -183,6 +183,7 @@ PMOD_EXPORT void check_all_args(const char *fnname, int args, ... )
 #define ARGS_SHORT	-2 /* At end of args but not fmt and has not passed a period. */
 #define ARGS_LONG	-3 /* At end of fmt but not args. */
 #define ARGS_NUL_IN_STRING -4	/* 8 bit string got embedded NUL. */
+#define ARGS_SUBTYPED_OBJECT -5	/* An object with a subtype. */
 /* Positive values: Stopped at arg with invalid type. The value is the
  * format letter for the expected type. */
 
@@ -413,6 +414,10 @@ static int va_get_args_2(struct svalue *s,
       /* FALL THROUGH */
     case 'o':
       if(s->type != T_OBJECT) goto type_err;
+      if (s->subtype) {
+	*info = ARGS_SUBTYPED_OBJECT;
+	return ret;
+      }
       *cast_arg(ptr, struct object **)=s->u.object;
       break;
 
@@ -518,6 +523,12 @@ PMOD_EXPORT void get_all_args(const char *fname, INT32 args,
 	ret+1, fname);
       /* NOT REACHED */
 
+    case ARGS_SUBTYPED_OBJECT:
+      bad_arg_error(fname, sp-args, args, ret+1, "object",
+		    sp+ret-args,
+		    "Subtyped objects are not supported.\n");
+      /* NOT_REACHED */
+
     case ARGS_SHORT:
     default: {
       char *expected_type;
-- 
GitLab