From 6398feefc747862defb24da81880683f21ea6ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Thu, 3 Apr 2003 16:40:15 +0200 Subject: [PATCH] Moved the definition of should_copy() to the beginning of the PIKECLASS. Also made it static, since inline implies static on several compilers. Rev: src/post_modules/_ADT/sequence.cmod:1.3 --- src/post_modules/_ADT/sequence.cmod | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/post_modules/_ADT/sequence.cmod b/src/post_modules/_ADT/sequence.cmod index f59e62207a..4a1e663ceb 100644 --- a/src/post_modules/_ADT/sequence.cmod +++ b/src/post_modules/_ADT/sequence.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: sequence.cmod,v 1.2 2003/03/18 11:36:20 peta Exp $ +|| $Id: sequence.cmod,v 1.3 2003/04/03 14:40:15 grubba Exp $ */ #include "global.h" @@ -40,6 +40,18 @@ PIKECLASS Sequence CVAR struct array **aptr; + //if there is more than one reference to this array copy it. + + static inline void should_copy() + { + if (THIS->a->refs > 1) + { + free_array(THIS->a); + THIS->a = copy_array(THIS->a); + } + } + + /*! @decl mixed `[](int index) *! Index operator *! @@ -548,18 +560,6 @@ PIKECLASS Sequence free_array(THIS->a); } - //if there is more than one reference to this array copy it. - - inline void should_copy() - { - if (THIS->a->refs > 1) - { - free_array(THIS->a); - THIS->a = copy_array(THIS->a); - } - } - - /*! @class SequenceIterator *! This is the iterator for the Sequence. It implements the *! IndexedIterator and the OutputIterator -- GitLab