From 0d2d714db29f6470ed6d9028c7335ac9caa556fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Wed, 3 Nov 2010 19:19:44 +0100 Subject: [PATCH] Shuffler()->set_backend() should now work as intended. There's a difference between an object and its storage... --- .gitattributes | 1 - src/post_modules/Shuffler/Shuffler.cmod | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitattributes b/.gitattributes index 9f073ad74c..abe536a398 100644 --- a/.gitattributes +++ b/.gitattributes @@ -756,7 +756,6 @@ testfont binary /src/post_modules/SQLite/configure.in foreign_ident /src/post_modules/SQLite/sqlite.cmod foreign_ident /src/post_modules/Shuffler/Makefile.in foreign_ident -/src/post_modules/Shuffler/Shuffler.cmod foreign_ident /src/post_modules/Shuffler/a_source_pikestring.c foreign_ident /src/post_modules/Shuffler/a_source_system_memory.c foreign_ident /src/post_modules/Shuffler/b_source_normal_file.c foreign_ident diff --git a/src/post_modules/Shuffler/Shuffler.cmod b/src/post_modules/Shuffler/Shuffler.cmod index 9dc030ae94..e0fc7dc599 100644 --- a/src/post_modules/Shuffler/Shuffler.cmod +++ b/src/post_modules/Shuffler/Shuffler.cmod @@ -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: Shuffler.cmod,v 1.51 2010/06/22 14:02:37 grubba Exp $ +|| $Id$ */ #include "global.h" @@ -584,7 +584,7 @@ PIKECLASS Shuffle mixed backend ) flags ID_PROTECTED; { - struct Backend_struct*be = default_backend; + struct Backend_struct *be = default_backend; if( (args != 4) || !shuffler || !get_storage( shuffler, Shuffler_program ) ) Pike_error("This class cannot be instantiated directly\n"); @@ -605,8 +605,14 @@ PIKECLASS Shuffle change_fd_for_box(&THIS->box, -1); else { safe_apply( fd, "release_fd", 0 ); - if(backend->type == PIKE_T_OBJECT && backend->u.object) - be = (struct Backend_struct*)backend->u.object; + if(backend->type == PIKE_T_OBJECT && backend->u.object) { + be = (struct Backend_struct*) + get_storage(backend->u.object, Backend_program); + if (!be) { + SIMPLE_BAD_ARG_ERROR("Shuffle->create()", 4, + "object(Pike.__Backend)"); + } + } change_fd_for_box(&THIS->box, Pike_sp[-1].u.integer); pop_stack(); } -- GitLab