From f600d21e6275bdb176d9ba458d07286b91c6ff91 Mon Sep 17 00:00:00 2001 From: Martin Nilsson <mani@lysator.liu.se> Date: Fri, 14 May 2004 01:28:50 +0200 Subject: [PATCH] Essentailly all callers of array_fix_type_field uses the type_field afterwards, so why not return it as well. Rev: src/array.c:1.159 Rev: src/array.h:1.60 --- src/array.c | 15 +++++++-------- src/array.h | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/array.c b/src/array.c index a18aba997e..26a2cf62e1 100644 --- a/src/array.c +++ b/src/array.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: array.c,v 1.158 2004/04/06 15:37:54 nilsson Exp $ +|| $Id: array.c,v 1.159 2004/05/13 23:28:49 nilsson Exp $ */ #include "global.h" @@ -26,7 +26,7 @@ #include "cyclic.h" #include "multiset.h" -RCSID("$Id: array.c,v 1.158 2004/04/06 15:37:54 nilsson Exp $"); +RCSID("$Id: array.c,v 1.159 2004/05/13 23:28:49 nilsson Exp $"); PMOD_EXPORT struct array empty_array= { @@ -1184,7 +1184,7 @@ PMOD_EXPORT struct array *reorder_and_copy_array(struct array *v, INT32 *order) } /* Maybe I should have a 'clean' flag for this computation */ -PMOD_EXPORT void array_fix_type_field(struct array *v) +PMOD_EXPORT TYPE_FIELD array_fix_type_field(struct array *v) { int e; TYPE_FIELD t; @@ -1194,7 +1194,7 @@ PMOD_EXPORT void array_fix_type_field(struct array *v) if(v->flags & ARRAY_LVALUE) { v->type_field=BIT_MIXED|BIT_UNFINISHED; - return; + return BIT_MIXED|BIT_UNFINISHED; } for(e=0; e<v->size; e++) { @@ -1211,6 +1211,7 @@ PMOD_EXPORT void array_fix_type_field(struct array *v) } #endif v->type_field = t; + return t; } #ifdef PIKE_DEBUG @@ -1772,10 +1773,9 @@ PMOD_EXPORT struct array *and_arrays(struct array *a, struct array *b) int array_is_constant(struct array *a, struct processing *p) { - array_fix_type_field(a); return svalues_are_constant(ITEM(a), a->size, - a->type_field, + array_fix_type_field(a), p); } @@ -1784,11 +1784,10 @@ node *make_node_from_array(struct array *a) struct svalue s; INT32 e; - array_fix_type_field(a); if(!a->size) return mkefuncallnode("aggregate",0); - if(a->type_field == BIT_INT) + if(array_fix_type_field(a) == BIT_INT) { debug_malloc_touch(a); for(e=0; e<a->size; e++) diff --git a/src/array.h b/src/array.h index 95d54b1b9e..c88cac80f5 100644 --- a/src/array.h +++ b/src/array.h @@ -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: array.h,v 1.59 2004/04/18 02:16:05 mast Exp $ +|| $Id: array.h,v 1.60 2004/05/13 23:28:50 nilsson Exp $ */ #ifndef ARRAY_H @@ -124,7 +124,7 @@ INT32 set_lookup(struct array *a, struct svalue *s); INT32 switch_lookup(struct array *a, struct svalue *s); PMOD_EXPORT struct array *order_array(struct array *v, INT32 *order); PMOD_EXPORT struct array *reorder_and_copy_array(struct array *v, INT32 *order); -PMOD_EXPORT void array_fix_type_field(struct array *v); +PMOD_EXPORT TYPE_FIELD array_fix_type_field(struct array *v); #ifdef PIKE_DEBUG void array_check_type_field(struct array *v); #endif -- GitLab