From 3e130caca0b22840f0ccef131ef1f736356435fb Mon Sep 17 00:00:00 2001 From: Martin Stjernholm <mast@lysator.liu.se> Date: Fri, 30 May 2008 16:37:05 +0200 Subject: [PATCH] Added a couple macros to make it simpler to initialize static svalues. Rev: src/svalue.h:1.159 --- src/svalue.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/svalue.h b/src/svalue.h index e0492e6ffc..f33eb379e9 100644 --- a/src/svalue.h +++ b/src/svalue.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: svalue.h,v 1.158 2008/05/11 14:47:57 mast Exp $ +|| $Id: svalue.h,v 1.159 2008/05/30 14:37:05 mast Exp $ */ #ifndef SVALUE_H @@ -1004,4 +1004,14 @@ struct ref_dummy PIKE_MEMORY_OBJECT_MEMBERS; }; +/* The following macro is useful to initialize static svalues. Note + * that the value isn't always set. */ +#ifdef HAVE_UNION_INIT +#define SVALUE_INIT_INT(VAL) {T_INT, NUMBER_NUMBER, {VAL}} +#define SVALUE_INIT_FREE {PIKE_T_FREE, NUMBER_NUMBER, {0}} +#else +#define SVALUE_INIT_INT(VAL) {T_INT, NUMBER_NUMBER} +#define SVALUE_INIT_FREE {PIKE_T_FREE, NUMBER_NUMBER} +#endif + #endif /* !SVALUE_H */ -- GitLab