From 90e978be3d2da5bee0358a2e56c4780c8712134b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Sun, 31 Jan 1999 18:47:18 -0800
Subject: [PATCH] all alignment problems solved (I hope)

Rev: src/Makefile.in:1.126
Rev: src/modules/Gdbm/gdbmmod.c:1.6
Rev: src/modules/Gmp/mpz_glue.c:1.37
Rev: src/modules/Gz/zlibmod.c:1.22
Rev: src/modules/Image/colors.c:1.8
Rev: src/modules/Image/colortable.c:1.47
Rev: src/modules/Image/font.c:1.42
Rev: src/modules/Image/image.c:1.110
Rev: src/modules/Msql/msqlmod.c:1.9
Rev: src/modules/Mysql/mysql.c:1.25
Rev: src/modules/Mysql/result.c:1.14
Rev: src/modules/Odbc/odbc.c:1.13
Rev: src/modules/Odbc/odbc_result.c:1.16
Rev: src/modules/Oracle/oracle.c:1.15
Rev: src/modules/Perl/perlmod.c:1.4
Rev: src/modules/Pipe/pipe.c:1.29
Rev: src/modules/Postgres/pgresult.c:1.9
Rev: src/modules/Postgres/postgres.c:1.11
Rev: src/modules/Regexp/glue.c:1.13
Rev: src/modules/Ssleay/ssleay.c:1.10
Rev: src/modules/Yp/yp.c:1.15
Rev: src/modules/_Charset/charsetmod.c:1.8
Rev: src/modules/_Charset/iso2022.c:1.3
Rev: src/modules/_Crypto/cast.c:1.5
Rev: src/modules/_Crypto/cbc.c:1.13
Rev: src/modules/_Crypto/crypto.c:1.26
Rev: src/modules/_Crypto/des.c:1.12
Rev: src/modules/_Crypto/idea.c:1.12
Rev: src/modules/_Crypto/md2.c:1.5
Rev: src/modules/_Crypto/md5.c:1.11
Rev: src/modules/_Crypto/pipe.c:1.13
Rev: src/modules/_Crypto/rc4.c:1.8
Rev: src/modules/_Crypto/sha.c:1.14
Rev: src/modules/_Image_TTF/image_ttf.c:1.9
Rev: src/modules/files/file.c:1.137
Rev: src/modules/files/socket.c:1.41
Rev: src/modules/spider/accesseddb.c:1.17
Rev: src/modules/spider/dumudp.c:1.42
Rev: src/modules/spider/xml.c:1.6
Rev: src/modules/system/nt.c:1.7
Rev: src/object.c:1.56
Rev: src/operators.c:1.45
Rev: src/pike_macros.h:1.11
Rev: src/program.c:1.108
Rev: src/program.h:1.49
Rev: src/security.c:1.8
Rev: src/signal_handler.c:1.102
Rev: src/stralloc.c:1.53
Rev: src/threads.c:1.87
---
 src/Makefile.in                    |   8 +--
 src/modules/Gdbm/gdbmmod.c         |   4 +-
 src/modules/Gmp/mpz_glue.c         |   4 +-
 src/modules/Gz/zlibmod.c           |   6 +-
 src/modules/Image/colors.c         |   6 +-
 src/modules/Image/colortable.c     |   8 +--
 src/modules/Image/font.c           |   6 +-
 src/modules/Image/image.c          |   8 +--
 src/modules/Msql/msqlmod.c         |   6 +-
 src/modules/Mysql/mysql.c          |   8 +--
 src/modules/Mysql/result.c         |   6 +-
 src/modules/Odbc/odbc.c            |   6 +-
 src/modules/Odbc/odbc_result.c     |   6 +-
 src/modules/Oracle/oracle.c        |   8 +--
 src/modules/Perl/perlmod.c         |   2 +-
 src/modules/Pipe/pipe.c            |   6 +-
 src/modules/Postgres/pgresult.c    |   6 +-
 src/modules/Postgres/postgres.c    |   4 +-
 src/modules/Regexp/glue.c          |   4 +-
 src/modules/Ssleay/ssleay.c        |   6 +-
 src/modules/Yp/yp.c                |   4 +-
 src/modules/_Charset/charsetmod.c  |  14 ++--
 src/modules/_Charset/iso2022.c     |   4 +-
 src/modules/_Crypto/cast.c         |   4 +-
 src/modules/_Crypto/cbc.c          |   4 +-
 src/modules/_Crypto/crypto.c       |   4 +-
 src/modules/_Crypto/des.c          |   4 +-
 src/modules/_Crypto/idea.c         |   4 +-
 src/modules/_Crypto/md2.c          |   4 +-
 src/modules/_Crypto/md5.c          |   4 +-
 src/modules/_Crypto/pipe.c         |   4 +-
 src/modules/_Crypto/rc4.c          |   4 +-
 src/modules/_Crypto/sha.c          |   6 +-
 src/modules/_Image_TTF/image_ttf.c |   8 +--
 src/modules/files/file.c           |   8 +--
 src/modules/files/socket.c         |   4 +-
 src/modules/spider/accesseddb.c    |   6 +-
 src/modules/spider/dumudp.c        |   6 +-
 src/modules/spider/xml.c           |   2 +-
 src/modules/system/nt.c            |   4 +-
 src/object.c                       |   4 +-
 src/operators.c                    |   4 +-
 src/pike_macros.h                  |  16 ++---
 src/program.c                      | 107 ++++++++++++++++++++++-------
 src/program.h                      |   9 ++-
 src/security.c                     |   2 +-
 src/signal_handler.c               |   4 +-
 src/stralloc.c                     |   6 +-
 src/threads.c                      |  12 ++--
 49 files changed, 219 insertions(+), 165 deletions(-)

diff --git a/src/Makefile.in b/src/Makefile.in
index 45787c11f9..49fb2092e2 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.in,v 1.125 1999/01/24 12:02:20 hubbe Exp $
+# $Id: Makefile.in,v 1.126 1999/02/01 02:41:39 hubbe Exp $
 #
 
 # This line is needed on some machines.
@@ -392,15 +392,15 @@ TAGS:
 	etags -t *.h *.c
 
 # verify / debug
-verify_modules:
-	( cd modules ; $(MAKE) $(MAKE_FLAGS) verify )
-
 module_testsuites:
 	( cd modules ; $(MAKE) $(MAKE_FLAGS) testsuites )
 
 verify: module_testsuites testsuite master.pike
 	$(RUNPIKE) $(TMP_BINDIR)/test_pike.pike modules/*/module_testsuite testsuite 
 
+verify_installed: module_testsuites testsuite master.pike
+	$(exec_prefix)/pike $(TMP_BINDIR)/test_pike.pike modules/*/module_testsuite testsuite 
+
 check: verify
 
 sure: verify
diff --git a/src/modules/Gdbm/gdbmmod.c b/src/modules/Gdbm/gdbmmod.c
index 998ef1b9c0..5d2a5fefb3 100644
--- a/src/modules/Gdbm/gdbmmod.c
+++ b/src/modules/Gdbm/gdbmmod.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: gdbmmod.c,v 1.5 1997/08/30 22:21:49 grubba Exp $");
+RCSID("$Id: gdbmmod.c,v 1.6 1999/02/01 02:42:09 hubbe Exp $");
 #include "gdbm_machine.h"
 #include "threads.h"
 
@@ -334,7 +334,7 @@ void pike_module_init(void)
 {
 #if defined(HAVE_GDBM_H) && defined(HAVE_LIBGDBM)
   start_new_program();
-  add_storage(sizeof(struct gdbm_glue));
+  ADD_STORAGE(struct gdbm_glue);
   
   add_function("create",gdbmmod_create,"function(void|string,void|string:void)",0);
 
diff --git a/src/modules/Gmp/mpz_glue.c b/src/modules/Gmp/mpz_glue.c
index 3ddf26ccd4..a5b05b1248 100644
--- a/src/modules/Gmp/mpz_glue.c
+++ b/src/modules/Gmp/mpz_glue.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: mpz_glue.c,v 1.36 1998/07/19 21:57:45 nisse Exp $");
+RCSID("$Id: mpz_glue.c,v 1.37 1999/02/01 02:42:21 hubbe Exp $");
 #include "gmp_machine.h"
 
 #if defined(HAVE_GMP2_GMP_H) && defined(HAVE_LIBGMP2)
@@ -920,7 +920,7 @@ void pike_module_init(void)
 {
 #if defined(USE_GMP) || defined(USE_GMP2)
   start_new_program();
-  add_storage(sizeof(MP_INT));
+  ADD_STORAGE(MP_INT);
   
   add_function("create", mpzmod_create,
   "function(void|string|int|float|object:void)"
diff --git a/src/modules/Gz/zlibmod.c b/src/modules/Gz/zlibmod.c
index db5e04cf5f..54ac5b9a67 100644
--- a/src/modules/Gz/zlibmod.c
+++ b/src/modules/Gz/zlibmod.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: zlibmod.c,v 1.21 1998/05/07 23:51:43 hubbe Exp $");
+RCSID("$Id: zlibmod.c,v 1.22 1999/02/01 02:42:32 hubbe Exp $");
 
 #include "zlib_machine.h"
 
@@ -377,7 +377,7 @@ void pike_module_init(void)
 {
 #ifdef HAVE_ZLIB_H
   start_new_program();
-  add_storage(sizeof(struct zipper));
+  ADD_STORAGE(struct zipper);
   
   add_function("create",gz_deflate_create,"function(int|void:void)",0);
   add_function("deflate",gz_deflate,"function(string,int|void:string)",0);
@@ -393,7 +393,7 @@ void pike_module_init(void)
   end_class("deflate",0);
 
   start_new_program();
-  add_storage(sizeof(struct zipper));
+  ADD_STORAGE(struct zipper);
   
   add_function("create",gz_inflate_create,"function(int|void:void)",0);
   add_function("inflate",gz_inflate,"function(string:string)",0);
diff --git a/src/modules/Image/colors.c b/src/modules/Image/colors.c
index 7edc22ec4e..89637b31cf 100644
--- a/src/modules/Image/colors.c
+++ b/src/modules/Image/colors.c
@@ -1,7 +1,7 @@
 /*
 **! module Image
 **! note
-**!	$Id: colors.c,v 1.7 1999/01/26 02:02:31 mirar Exp $
+**!	$Id: colors.c,v 1.8 1999/02/01 02:43:09 hubbe Exp $
 **! submodule color
 **!
 **!	This module keeps names and easy handling 
@@ -97,7 +97,7 @@
 #include "global.h"
 #include <config.h>
 
-RCSID("$Id: colors.c,v 1.7 1999/01/26 02:02:31 mirar Exp $");
+RCSID("$Id: colors.c,v 1.8 1999/02/01 02:43:09 hubbe Exp $");
 
 #include "config.h"
 
@@ -1392,7 +1392,7 @@ void init_image_colors(void)
 
    start_new_program();
 
-   add_storage(sizeof(struct color_struct));
+   ADD_STORAGE(struct color_struct);
    set_init_callback(init_color_struct);
    set_exit_callback(exit_color_struct);
 
diff --git a/src/modules/Image/colortable.c b/src/modules/Image/colortable.c
index 8ee2d5d56a..62842f7bce 100644
--- a/src/modules/Image/colortable.c
+++ b/src/modules/Image/colortable.c
@@ -1,12 +1,12 @@
 #include "global.h"
 #include <config.h>
 
-/* $Id: colortable.c,v 1.46 1998/04/30 00:00:57 mirar Exp $ */
+/* $Id: colortable.c,v 1.47 1999/02/01 02:43:10 hubbe Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: colortable.c,v 1.46 1998/04/30 00:00:57 mirar Exp $
+**!	$Id: colortable.c,v 1.47 1999/02/01 02:43:10 hubbe Exp $
 **! class colortable
 **!
 **!	This object keeps colortable information,
@@ -21,7 +21,7 @@
 #undef COLORTABLE_DEBUG
 #undef COLORTABLE_REDUCE_DEBUG
 
-RCSID("$Id: colortable.c,v 1.46 1998/04/30 00:00:57 mirar Exp $");
+RCSID("$Id: colortable.c,v 1.47 1999/02/01 02:43:10 hubbe Exp $");
 
 #include <math.h> /* fabs() */
 
@@ -3911,7 +3911,7 @@ void image_colortable_image(INT32 args)
 void init_colortable_programs(void)
 {
    start_new_program();
-   add_storage(sizeof(struct neo_colortable));
+   ADD_STORAGE(struct neo_colortable);
 
    set_init_callback(init_colortable_struct);
 
diff --git a/src/modules/Image/font.c b/src/modules/Image/font.c
index 734890b9d2..a23efcd639 100644
--- a/src/modules/Image/font.c
+++ b/src/modules/Image/font.c
@@ -1,4 +1,4 @@
-/* $Id: font.c,v 1.41 1998/11/03 08:38:05 per Exp $ */
+/* $Id: font.c,v 1.42 1999/02/01 02:43:12 hubbe Exp $ */
 #include "global.h"
 #include <config.h>
 
@@ -7,7 +7,7 @@
 /*
 **! module Image
 **! note
-**!	$Id: font.c,v 1.41 1998/11/03 08:38:05 per Exp $
+**!	$Id: font.c,v 1.42 1999/02/01 02:43:12 hubbe Exp $
 **! class font
 **!
 **! note
@@ -881,7 +881,7 @@ int baseline();             // font baseline
 void init_font_programs(void)
 {
    start_new_program();
-   add_storage(sizeof(struct font*));
+   ADD_STORAGE(struct font*);
 
    add_function("load",font_load,
                 "function(string:object|int)",0);
diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c
index 83dd67f8e9..778ff9660c 100644
--- a/src/modules/Image/image.c
+++ b/src/modules/Image/image.c
@@ -1,9 +1,9 @@
-/* $Id: image.c,v 1.109 1999/01/26 02:23:33 mirar Exp $ */
+/* $Id: image.c,v 1.110 1999/02/01 02:43:13 hubbe Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: image.c,v 1.109 1999/01/26 02:23:33 mirar Exp $
+**!	$Id: image.c,v 1.110 1999/02/01 02:43:13 hubbe Exp $
 **! class image
 **!
 **!	The main object of the <ref>Image</ref> module, this object
@@ -97,7 +97,7 @@
 
 #include "stralloc.h"
 #include "global.h"
-RCSID("$Id: image.c,v 1.109 1999/01/26 02:23:33 mirar Exp $");
+RCSID("$Id: image.c,v 1.110 1999/02/01 02:43:13 hubbe Exp $");
 #include "pike_macros.h"
 #include "object.h"
 #include "constants.h"
@@ -3546,7 +3546,7 @@ void pike_module_init(void)
    image_noise_init();
 
    start_new_program();
-   add_storage(sizeof(struct image));
+   ADD_STORAGE(struct image);
 
    add_function("create",image_create,
 		"function(int|void,int|void,"RGB_TYPE":void)",0);
diff --git a/src/modules/Msql/msqlmod.c b/src/modules/Msql/msqlmod.c
index cce0d7d6a5..7c9494e093 100644
--- a/src/modules/Msql/msqlmod.c
+++ b/src/modules/Msql/msqlmod.c
@@ -2,7 +2,7 @@
  * This code is (C) Francesco Chemolli, 1997.
  * You may use, modify and redistribute it freely under the terms
  * of the GNU General Public License, version 2.
- * $Id: msqlmod.c,v 1.8 1998/07/04 16:58:06 grubba Exp $
+ * $Id: msqlmod.c,v 1.9 1999/02/01 02:43:37 hubbe Exp $
  *
  * This version is intended for Pike/0.5 and later.
  * It won't compile under older versions of the Pike interpreter.
@@ -35,7 +35,7 @@
 #include "operators.h"
 #include "multiset.h"
 
-RCSID("$Id: msqlmod.c,v 1.8 1998/07/04 16:58:06 grubba Exp $");
+RCSID("$Id: msqlmod.c,v 1.9 1999/02/01 02:43:37 hubbe Exp $");
 #include "version.h"
 
 #ifdef _REENTRANT
@@ -706,7 +706,7 @@ static void do_list_index (INT32 args)
 void pike_module_init(void)
 {
 	start_new_program();
-	add_storage(sizeof(struct msql_my_data));
+	ADD_STORAGE(struct msql_my_data);
 
 	set_init_callback (msql_object_created);
 	set_exit_callback (msql_object_destroyed);
diff --git a/src/modules/Mysql/mysql.c b/src/modules/Mysql/mysql.c
index 5f91ba545e..0082c90ecb 100644
--- a/src/modules/Mysql/mysql.c
+++ b/src/modules/Mysql/mysql.c
@@ -1,5 +1,5 @@
 /*
- * $Id: mysql.c,v 1.24 1998/09/01 17:01:04 hubbe Exp $
+ * $Id: mysql.c,v 1.25 1999/02/01 02:43:55 hubbe Exp $
  *
  * SQL database functionality for Pike
  *
@@ -79,7 +79,7 @@ typedef struct dynamic_buffer_s dynamic_buffer;
  * Globals
  */
 
-RCSID("$Id: mysql.c,v 1.24 1998/09/01 17:01:04 hubbe Exp $");
+RCSID("$Id: mysql.c,v 1.25 1999/02/01 02:43:55 hubbe Exp $");
 
 /*
 **! module Mysql
@@ -91,7 +91,7 @@ RCSID("$Id: mysql.c,v 1.24 1998/09/01 17:01:04 hubbe Exp $");
 **! see also: Mysql.mysql, Mysql.result, Sql.sql
 **!
 **! note
-**!	$Id: mysql.c,v 1.24 1998/09/01 17:01:04 hubbe Exp $
+**!	$Id: mysql.c,v 1.25 1999/02/01 02:43:55 hubbe Exp $
 **! class mysql
 **!
 **!	Mysql.mysql is a pre-compiled Pike program. It enables
@@ -1369,7 +1369,7 @@ void pike_module_init(void)
    */
  
   start_new_program();
-  add_storage(sizeof(struct precompiled_mysql));
+  ADD_STORAGE(struct precompiled_mysql);
 
   add_function("error", f_error, "function(void:int|string)", ID_PUBLIC);
   add_function("create", f_create, "function(string|void, string|void, string|void, string|void:void)", ID_PUBLIC);
diff --git a/src/modules/Mysql/result.c b/src/modules/Mysql/result.c
index 33b9a85cfc..5e8ebefc25 100644
--- a/src/modules/Mysql/result.c
+++ b/src/modules/Mysql/result.c
@@ -1,5 +1,5 @@
 /*
- * $Id: result.c,v 1.13 1998/09/01 17:01:06 hubbe Exp $
+ * $Id: result.c,v 1.14 1999/02/01 02:43:56 hubbe Exp $
  *
  * mysql query result
  *
@@ -83,7 +83,7 @@ typedef struct dynamic_buffer_s dynamic_buffer;
  * Globals
  */
 
-RCSID("$Id: result.c,v 1.13 1998/09/01 17:01:06 hubbe Exp $");
+RCSID("$Id: result.c,v 1.14 1999/02/01 02:43:56 hubbe Exp $");
 
 struct program *mysql_result_program = NULL;
 
@@ -436,7 +436,7 @@ void init_mysql_res_programs(void)
    */
  
   start_new_program();
-  add_storage(sizeof(struct precompiled_mysql_result));
+  ADD_STORAGE(struct precompiled_mysql_result);
 
   add_function("create", f_create, "function(object:void)", ID_PUBLIC);
   add_function("num_rows", f_num_rows, "function(void:int)", ID_PUBLIC);
diff --git a/src/modules/Odbc/odbc.c b/src/modules/Odbc/odbc.c
index 4d408a746f..57fb1262bd 100644
--- a/src/modules/Odbc/odbc.c
+++ b/src/modules/Odbc/odbc.c
@@ -1,5 +1,5 @@
 /*
- * $Id: odbc.c,v 1.12 1998/11/22 11:04:48 hubbe Exp $
+ * $Id: odbc.c,v 1.13 1999/02/01 02:44:08 hubbe Exp $
  *
  * Pike interface to ODBC compliant databases.
  *
@@ -16,7 +16,7 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-RCSID("$Id: odbc.c,v 1.12 1998/11/22 11:04:48 hubbe Exp $");
+RCSID("$Id: odbc.c,v 1.13 1999/02/01 02:44:08 hubbe Exp $");
 
 #include "interpret.h"
 #include "object.h"
@@ -325,7 +325,7 @@ void pike_module_init(void)
   }
 
   start_new_program();
-  add_storage(sizeof(struct precompiled_odbc));
+  ADD_STORAGE(struct precompiled_odbc);
 
   add_function("error", f_error, "function(void:int|string)", ID_PUBLIC);
   add_function("create", f_create, "function(string|void, string|void, string|void, string|void:void)", ID_PUBLIC);
diff --git a/src/modules/Odbc/odbc_result.c b/src/modules/Odbc/odbc_result.c
index 195f31bc0a..414ba9f1e8 100644
--- a/src/modules/Odbc/odbc_result.c
+++ b/src/modules/Odbc/odbc_result.c
@@ -1,5 +1,5 @@
 /*
- * $Id: odbc_result.c,v 1.15 1998/10/19 00:56:27 grubba Exp $
+ * $Id: odbc_result.c,v 1.16 1999/02/01 02:44:10 hubbe Exp $
  *
  * Pike  interface to ODBC compliant databases
  *
@@ -16,7 +16,7 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-RCSID("$Id: odbc_result.c,v 1.15 1998/10/19 00:56:27 grubba Exp $");
+RCSID("$Id: odbc_result.c,v 1.16 1999/02/01 02:44:10 hubbe Exp $");
 
 #include "interpret.h"
 #include "object.h"
@@ -491,7 +491,7 @@ void init_odbc_res_programs(void)
    */
  
   start_new_program();
-  add_storage(sizeof(struct precompiled_odbc_result));
+  ADD_STORAGE(struct precompiled_odbc_result);
 
   map_variable("_odbc", "object", 0,
 	       OFFSETOF(precompiled_odbc_result, obj), T_OBJECT);
diff --git a/src/modules/Oracle/oracle.c b/src/modules/Oracle/oracle.c
index 9503d7fca7..46c1df7bf3 100644
--- a/src/modules/Oracle/oracle.c
+++ b/src/modules/Oracle/oracle.c
@@ -1,5 +1,5 @@
 /*
- * $Id: oracle.c,v 1.14 1998/07/04 17:00:25 grubba Exp $
+ * $Id: oracle.c,v 1.15 1999/02/01 02:44:20 hubbe Exp $
  *
  * Pike interface to Oracle databases.
  *
@@ -36,7 +36,7 @@
 
 #endif
 
-RCSID("$Id: oracle.c,v 1.14 1998/07/04 17:00:25 grubba Exp $");
+RCSID("$Id: oracle.c,v 1.15 1999/02/01 02:44:20 hubbe Exp $");
 
 #ifdef HAVE_ORACLE
 
@@ -702,7 +702,7 @@ void pike_module_init(void)
   /*  opinit(OCI_EV_TSF); */
 
   start_new_program();
-  add_storage(sizeof(struct dbcon));
+  ADD_STORAGE(struct dbcon);
 
   add_function("create", f_create, "function(string|void, string|void, string|void, string|void:void)", ID_PUBLIC);
   add_function("big_query", f_big_query, "function(string,mapping(int|string:int|float|string|multiset(string))|void:object)", ID_PUBLIC);
@@ -715,7 +715,7 @@ void pike_module_init(void)
   add_program_constant("oracle", oracle_program, 0);
 
   start_new_program();
-  add_storage(sizeof(struct dbresult));
+  ADD_STORAGE(struct dbresult);
 
   add_function("create", f_result_create, "function(object, array(string|int):void)", ID_PUBLIC);
   add_function("num_fields", f_num_fields, "function(:int)", ID_PUBLIC);
diff --git a/src/modules/Perl/perlmod.c b/src/modules/Perl/perlmod.c
index 73809f6f3e..efaf61fec6 100644
--- a/src/modules/Perl/perlmod.c
+++ b/src/modules/Perl/perlmod.c
@@ -221,7 +221,7 @@ void pike_module_init(void)
 {
   perl_destruct_level=2;
   start_new_program();
-  add_storage(sizeof(struct perlmod_storage));
+  ADD_STORAGE(struct perlmod_storage);
   add_function("create",perlmod_create,"function(array(string),void|mapping(string:string):int)",0);
   add_function("run",perlmod_run,"function(:int)",0);
   add_function("eval",perlmod_eval,"function(string:int)",0);
diff --git a/src/modules/Pipe/pipe.c b/src/modules/Pipe/pipe.c
index 70e16deb9c..2dab0737e9 100644
--- a/src/modules/Pipe/pipe.c
+++ b/src/modules/Pipe/pipe.c
@@ -26,7 +26,7 @@
 
 #include <fcntl.h>
 
-RCSID("$Id: pipe.c,v 1.28 1998/10/23 01:03:18 grubba Exp $");
+RCSID("$Id: pipe.c,v 1.29 1999/02/01 02:44:43 hubbe Exp $");
 
 #include "threads.h"
 #include "stralloc.h"
@@ -1241,7 +1241,7 @@ void f__pipe_debug(INT32 args)
 void pike_module_init(void)
 {
    start_new_program();
-   add_storage(sizeof(struct pipe));
+   ADD_STORAGE(struct pipe);
    add_efun("_pipe_debug", f__pipe_debug, "function(:array)", 0);
    add_function("input",pipe_input,"function(object:void)",0);
    add_function("output",pipe_output,"function(object:void)",0);
@@ -1285,7 +1285,7 @@ void pike_module_init(void)
 
 
    start_new_program();
-   add_storage(sizeof(struct output));
+   ADD_STORAGE(struct output);
    set_init_callback(init_output_struct);
    set_exit_callback(exit_output_struct);
    output_program=end_program();
diff --git a/src/modules/Postgres/pgresult.c b/src/modules/Postgres/pgresult.c
index 385d7dc237..fe26b9f9b4 100644
--- a/src/modules/Postgres/pgresult.c
+++ b/src/modules/Postgres/pgresult.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pgresult.c,v 1.8 1998/07/15 19:01:31 grubba Exp $
+ * $Id: pgresult.c,v 1.9 1999/02/01 02:45:00 hubbe Exp $
  *
  * Postgres95 support for pike/0.5 and up
  *
@@ -63,7 +63,7 @@
 #include "builtin_functions.h"
 #include "module_support.h"
 
-RCSID("$Id: pgresult.c,v 1.8 1998/07/15 19:01:31 grubba Exp $");
+RCSID("$Id: pgresult.c,v 1.9 1999/02/01 02:45:00 hubbe Exp $");
 
 #ifdef _REENTRANT
 MUTEX_T pike_postgres_result_mutex;
@@ -216,7 +216,7 @@ struct program * pgresult_program;
 void pgresult_init (void)
 {
 	start_new_program();
-	add_storage(sizeof(struct postgres_result_object_data));
+	ADD_STORAGE(struct postgres_result_object_data);
 	set_init_callback(result_create);
 	set_exit_callback(result_destroy);
 
diff --git a/src/modules/Postgres/postgres.c b/src/modules/Postgres/postgres.c
index c2391a6da9..348646f2b7 100644
--- a/src/modules/Postgres/postgres.c
+++ b/src/modules/Postgres/postgres.c
@@ -62,7 +62,7 @@ static void pgdebug (char * a, ...) {}
 
 struct program * postgres_program;
 
-RCSID("$Id: postgres.c,v 1.10 1998/11/22 11:05:17 hubbe Exp $");
+RCSID("$Id: postgres.c,v 1.11 1999/02/01 02:45:01 hubbe Exp $");
 
 #define THIS ((struct pgres_object_data *) fp->current_storage)
 
@@ -429,7 +429,7 @@ static void f_host_info (INT32 args)
 void pike_module_init (void)
 {
 	start_new_program();
-	add_storage(sizeof(struct pgres_object_data));
+	ADD_STORAGE(struct pgres_object_data);
 	set_init_callback(pgres_create);
 	set_exit_callback(pgres_destroy);
 
diff --git a/src/modules/Regexp/glue.c b/src/modules/Regexp/glue.c
index 567c0d6f10..8461ea0ddc 100644
--- a/src/modules/Regexp/glue.c
+++ b/src/modules/Regexp/glue.c
@@ -19,7 +19,7 @@
 #include "threads.h"
 #include "module_support.h"
 
-RCSID("$Id: glue.c,v 1.12 1998/07/04 17:02:00 grubba Exp $");
+RCSID("$Id: glue.c,v 1.13 1999/02/01 02:45:11 hubbe Exp $");
 
 #ifdef USE_SYSTEM_REGEXP
 #include <regexp.h>
@@ -204,7 +204,7 @@ void pike_module_exit(void) {}
 void pike_module_init(void)
 {
   start_new_program();
-  add_storage(sizeof(struct regexp_glue));
+  ADD_STORAGE(struct regexp_glue);
   
   add_function("create",regexp_create,"function(void|string:void)",0);
   add_function("match",regexp_match,"function(string:int)",0);
diff --git a/src/modules/Ssleay/ssleay.c b/src/modules/Ssleay/ssleay.c
index 60bbcabd9f..843a83fb9c 100644
--- a/src/modules/Ssleay/ssleay.c
+++ b/src/modules/Ssleay/ssleay.c
@@ -8,7 +8,7 @@
 
 #include "config.h"
 
-RCSID("$Id: ssleay.c,v 1.9 1998/07/04 17:02:27 grubba Exp $");
+RCSID("$Id: ssleay.c,v 1.10 1999/02/01 02:45:21 hubbe Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "stralloc.h"
@@ -281,7 +281,7 @@ void pike_module_init(void)
   ssleay_init_threads();
 #endif /* _REENTRANT */
   start_new_program();
-  add_storage(sizeof(struct ssleay_context));
+  ADD_STORAGE(struct ssleay_context);
 
   add_function("create", ssleay_create, "function(void:void)",0);
   add_function("use_certificate_file", ssleay_use_certificate_file, "function(string:void)", 0);
@@ -295,7 +295,7 @@ void pike_module_init(void)
   add_program_constant("ssleay", ssleay_program, 0);
   
   start_new_program();
-  add_storage(sizeof(struct ssleay_connection));
+  ADD_STORAGE(struct ssleay_connection);
 
   add_function("create", ssleay_connection_create, "function(object:void)",0);
   add_function("accept", ssleay_connection_accept, "function(void:int)", 0);
diff --git a/src/modules/Yp/yp.c b/src/modules/Yp/yp.c
index 90f4726174..ec422ba2eb 100644
--- a/src/modules/Yp/yp.c
+++ b/src/modules/Yp/yp.c
@@ -28,7 +28,7 @@
 #include "builtin_functions.h"
 #include "module_support.h"
 
-RCSID("$Id: yp.c,v 1.14 1998/08/08 13:56:56 grubba Exp $");
+RCSID("$Id: yp.c,v 1.15 1999/02/01 02:45:31 hubbe Exp $");
 
 #define YPERROR(fun,err) do{ if(err) error("yp->%s(): %s\n", (fun), \
                                            yperr_string(err)); }while(0)
@@ -221,7 +221,7 @@ void pike_module_init(void)
 
   start_new_program();
 
-  add_storage(sizeof(struct my_yp_domain));
+  ADD_STORAGE(struct my_yp_domain);
   
   set_init_callback( init_yp_struct );
   set_exit_callback( exit_yp_struct );
diff --git a/src/modules/_Charset/charsetmod.c b/src/modules/_Charset/charsetmod.c
index c52325f776..a92eb63980 100644
--- a/src/modules/_Charset/charsetmod.c
+++ b/src/modules/_Charset/charsetmod.c
@@ -3,7 +3,7 @@
 #endif /* HAVE_CONFIG_H */
 
 #include "global.h"
-RCSID("$Id: charsetmod.c,v 1.7 1999/01/05 15:38:06 marcus Exp $");
+RCSID("$Id: charsetmod.c,v 1.8 1999/02/01 02:45:42 hubbe Exp $");
 #include "program.h"
 #include "interpret.h"
 #include "stralloc.h"
@@ -1065,7 +1065,7 @@ void pike_module_init(void)
     add_program_constant("ISO2022", iso2022_program, ID_STATIC|ID_NOMASK);
 
   start_new_program();
-  add_storage(sizeof(struct std_cs_stor));
+  ADD_STORAGE(struct std_cs_stor);
   add_function("drain", f_drain, "function(:string)", 0);
   add_function("clear", f_clear, "function(:object)", 0);
   add_function("create", f_create, "function(string|void:void)", 0);
@@ -1083,7 +1083,7 @@ void pike_module_init(void)
 
   start_new_program();
   do_inherit(&prog, 0, NULL);
-  utf7_stor_offs = add_storage(sizeof(struct utf7_stor));
+  utf7_stor_offs = ADD_STORAGE(struct utf7_stor);
   add_function("feed", f_feed_utf7, "function(string:object)", 0);
   add_function("clear", f_clear_utf7, "function(:object)", 0);
   set_init_callback(utf7_init_stor);
@@ -1109,7 +1109,7 @@ void pike_module_init(void)
 
   start_new_program();
   do_inherit(&prog, 0, NULL);
-  std8e_stor_offs = add_storage(sizeof(struct std8e_stor));
+  std8e_stor_offs = ADD_STORAGE(struct std8e_stor);
   add_function("feed", f_feed_std8e, "function(string:object)", 0);
   set_init_callback(std_8bite_init_stor);
   set_exit_callback(std_8bite_exit_stor);
@@ -1117,7 +1117,7 @@ void pike_module_init(void)
 
   start_new_program();
   do_inherit(&prog, 0, NULL);
-  std16e_stor_offs = add_storage(sizeof(struct std16e_stor));
+  std16e_stor_offs = ADD_STORAGE(struct std16e_stor);
   add_function("feed", f_feed_std16e, "function(string:object)", 0);
   set_init_callback(std_16bite_init_stor);
   set_exit_callback(std_16bite_exit_stor);
@@ -1125,7 +1125,7 @@ void pike_module_init(void)
 
   start_new_program();
   do_inherit(&prog, 0, NULL);
-  std_rfc_stor_offs = add_storage(sizeof(struct std_rfc_stor));
+  std_rfc_stor_offs = ADD_STORAGE(struct std_rfc_stor);
   std_rfc_program = end_program();
 
   prog.u.program = std_rfc_program;
@@ -1152,7 +1152,7 @@ void pike_module_init(void)
 
   start_new_program();
   do_inherit(&prog, 0, NULL);
-  std_misc_stor_offs = add_storage(sizeof(struct std_misc_stor));
+  std_misc_stor_offs = ADD_STORAGE(struct std_misc_stor);
   add_function("feed", f_feed_8bit, "function(string:object)", 0);
   std_8bit_program = end_program();
 
diff --git a/src/modules/_Charset/iso2022.c b/src/modules/_Charset/iso2022.c
index bff268c6eb..4b3bb5ae38 100644
--- a/src/modules/_Charset/iso2022.c
+++ b/src/modules/_Charset/iso2022.c
@@ -3,7 +3,7 @@
 #endif /* HAVE_CONFIG_H */
 
 #include "global.h"
-RCSID("$Id: iso2022.c,v 1.2 1998/11/06 02:27:20 marcus Exp $");
+RCSID("$Id: iso2022.c,v 1.3 1999/02/01 02:45:44 hubbe Exp $");
 #include "program.h"
 #include "interpret.h"
 #include "stralloc.h"
@@ -409,7 +409,7 @@ static void exit_stor(struct object *o)
 struct program *iso2022_init(void)
 {
   start_new_program();
-  add_storage(sizeof(struct iso2022_stor));
+  ADD_STORAGE(struct iso2022_stor);
   add_function("feed", f_feed, "function(string:object)", 0);
   add_function("drain", f_drain, "function(:string)", 0);
   add_function("clear", f_clear, "function(:object)", 0);
diff --git a/src/modules/_Crypto/cast.c b/src/modules/_Crypto/cast.c
index 26319bcb8a..e61c3a5f30 100644
--- a/src/modules/_Crypto/cast.c
+++ b/src/modules/_Crypto/cast.c
@@ -1,5 +1,5 @@
 /*
- * $Id: cast.c,v 1.4 1998/04/24 00:59:26 hubbe Exp $
+ * $Id: cast.c,v 1.5 1999/02/01 02:45:57 hubbe Exp $
  *
  * CAST crypto module for Pike
  *
@@ -172,7 +172,7 @@ void pike_cast_init(void)
    */
 
   start_new_program();
-  add_storage(sizeof(struct pike_crypto_cast));
+  ADD_STORAGE(struct pike_crypto_cast);
 
   add_function("name", f_name, "function(void:string)", 0);
   add_function("query_block_size", f_query_block_size, "function(void:int)", 0);
diff --git a/src/modules/_Crypto/cbc.c b/src/modules/_Crypto/cbc.c
index 2d14e4f363..f705ea2c7e 100644
--- a/src/modules/_Crypto/cbc.c
+++ b/src/modules/_Crypto/cbc.c
@@ -1,5 +1,5 @@
 /*
- * $Id: cbc.c,v 1.12 1998/08/26 16:33:48 nisse Exp $
+ * $Id: cbc.c,v 1.13 1999/02/01 02:45:58 hubbe Exp $
  *
  * CBC (Cipher Block Chaining Mode) crypto module for Pike.
  *
@@ -331,7 +331,7 @@ void pike_cbc_init(void)
    */
 
   start_new_program();
-  add_storage(sizeof(struct pike_crypto_cbc));
+  ADD_STORAGE(struct pike_crypto_cbc);
 
   add_function("create", f_create, "function(program|object:void)", 0);
 
diff --git a/src/modules/_Crypto/crypto.c b/src/modules/_Crypto/crypto.c
index 1b1ea777b9..d7dda61d38 100644
--- a/src/modules/_Crypto/crypto.c
+++ b/src/modules/_Crypto/crypto.c
@@ -1,5 +1,5 @@
 /*
- * $Id: crypto.c,v 1.25 1998/04/20 18:53:55 grubba Exp $
+ * $Id: crypto.c,v 1.26 1999/02/01 02:45:59 hubbe Exp $
  *
  * A pike module for getting access to some common cryptos.
  *
@@ -465,7 +465,7 @@ void pike_crypto_init(void)
    */
   
   start_new_program();
-  add_storage(sizeof(struct pike_crypto));
+  ADD_STORAGE(struct pike_crypto);
 
   add_function("create", f_create, "function(program|object:void)", 0);
 
diff --git a/src/modules/_Crypto/des.c b/src/modules/_Crypto/des.c
index f140540864..7a8a2f2962 100644
--- a/src/modules/_Crypto/des.c
+++ b/src/modules/_Crypto/des.c
@@ -1,5 +1,5 @@
 /*
- * $Id: des.c,v 1.11 1998/01/13 23:01:11 hubbe Exp $
+ * $Id: des.c,v 1.12 1999/02/01 02:46:00 hubbe Exp $
  *
  * A pike module for getting access to some common cryptos.
  *
@@ -178,7 +178,7 @@ void pike_des_init(void)
 
   /* /precompiled/crypto/des */
   start_new_program();
-  add_storage(sizeof(struct pike_crypto_des));
+  ADD_STORAGE(struct pike_crypto_des);
 
   add_function("query_block_size", f_query_block_size, "function(void:int)", 0);
   add_function("query_key_length", f_query_key_length, "function(void:int)", 0);
diff --git a/src/modules/_Crypto/idea.c b/src/modules/_Crypto/idea.c
index 9632b850af..ab4f4697bc 100644
--- a/src/modules/_Crypto/idea.c
+++ b/src/modules/_Crypto/idea.c
@@ -1,5 +1,5 @@
 /*
- * $Id: idea.c,v 1.11 1998/04/24 00:59:26 hubbe Exp $
+ * $Id: idea.c,v 1.12 1999/02/01 02:46:02 hubbe Exp $
  *
  * IDEA crypto module for Pike
  *
@@ -158,7 +158,7 @@ void pike_idea_init(void)
    */
 
   start_new_program();
-  add_storage(sizeof(INT16[IDEA_KEYLEN]));
+  low_add_storage(sizeof(INT16[IDEA_KEYLEN]),ALIGNOF(INT16),0);
 
   add_function("name", f_name, "function(void:string)", 0);
   add_function("query_block_size", f_query_block_size, "function(void:int)", 0);
diff --git a/src/modules/_Crypto/md2.c b/src/modules/_Crypto/md2.c
index 2eb6f0b86e..1ddc730482 100644
--- a/src/modules/_Crypto/md2.c
+++ b/src/modules/_Crypto/md2.c
@@ -1,5 +1,5 @@
 /*
- * $Id: md2.c,v 1.4 1998/04/20 18:53:56 grubba Exp $
+ * $Id: md2.c,v 1.5 1999/02/01 02:46:03 hubbe Exp $
  *
  * A pike module for getting access to some common cryptos.
  *
@@ -155,7 +155,7 @@ void init_md2_programs(void)
 
   /* /precompiled/crypto/md2 */
   start_new_program();
-  add_storage(sizeof(struct pike_md2));
+  ADD_STORAGE(struct pike_md2);
 
   add_function("push", f_push, "function(string:void)", 0);
   add_function("cast", f_cast, "function(string:mixed)", 0);
diff --git a/src/modules/_Crypto/md5.c b/src/modules/_Crypto/md5.c
index 3f1b4c283f..06b8cdcddc 100644
--- a/src/modules/_Crypto/md5.c
+++ b/src/modules/_Crypto/md5.c
@@ -1,5 +1,5 @@
 /*
- * $Id: md5.c,v 1.10 1998/07/19 23:04:33 grubba Exp $
+ * $Id: md5.c,v 1.11 1999/02/01 02:46:04 hubbe Exp $
  *
  * A pike module for getting access to some common cryptos.
  *
@@ -100,7 +100,7 @@ void pike_md5_exit(void)
 void pike_md5_init(void)
 {
   start_new_program();
-  add_storage(sizeof(struct md5_ctx));
+  ADD_STORAGE(struct md5_ctx);
   add_function("name", f_name, "function(void:string)", 0);
   add_function("create", f_create, "function(void|object:void)", 0);
   add_function("update", f_update, "function(string:object)", 0);
diff --git a/src/modules/_Crypto/pipe.c b/src/modules/_Crypto/pipe.c
index 895e5bfb22..071b43d957 100644
--- a/src/modules/_Crypto/pipe.c
+++ b/src/modules/_Crypto/pipe.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pipe.c,v 1.12 1998/04/20 18:53:57 grubba Exp $
+ * $Id: pipe.c,v 1.13 1999/02/01 02:46:05 hubbe Exp $
  *
  * PIPE crypto module for Pike.
  *
@@ -304,7 +304,7 @@ void pike_pipe_init(void)
 
   /* /precompiled/crypto/pipe */
   start_new_program();
-  add_storage(sizeof(struct pike_crypto_pipe));
+  ADD_STORAGE(struct pike_crypto_pipe);
 
   add_function("create", f_create,
 	       "function(program|object|array(program|mixed) ...:void)", 0);
diff --git a/src/modules/_Crypto/rc4.c b/src/modules/_Crypto/rc4.c
index 7c8918603d..9581102a1a 100644
--- a/src/modules/_Crypto/rc4.c
+++ b/src/modules/_Crypto/rc4.c
@@ -16,7 +16,7 @@
 
 #include "rc4.h"
 
-RCSID("$Id: rc4.c,v 1.7 1998/04/24 00:59:26 hubbe Exp $");
+RCSID("$Id: rc4.c,v 1.8 1999/02/01 02:46:06 hubbe Exp $");
 
 #undef THIS
 #define THIS ((struct rc4_ctx *)(fp->current_storage))
@@ -96,7 +96,7 @@ static void f_crypt(INT32 args)
 void pike_rc4_init(void)
 {
   start_new_program();
-  add_storage(sizeof(struct rc4_ctx));
+  ADD_STORAGE(struct rc4_ctx);
 
   add_function("name", f_name, "function(void:string)", 0);
   add_function("query_key_length", f_query_key_length, "function(void:int)", 0);
diff --git a/src/modules/_Crypto/sha.c b/src/modules/_Crypto/sha.c
index 5973617988..155baade33 100644
--- a/src/modules/_Crypto/sha.c
+++ b/src/modules/_Crypto/sha.c
@@ -1,4 +1,4 @@
-/* $Id: sha.c,v 1.13 1998/07/19 23:08:06 grubba Exp $
+/* $Id: sha.c,v 1.14 1999/02/01 02:46:07 hubbe Exp $
  *
  * Written by Niels Möller
  */
@@ -16,7 +16,7 @@
 #include "module_support.h"
 #include "las.h"
 
-RCSID("$Id: sha.c,v 1.13 1998/07/19 23:08:06 grubba Exp $");
+RCSID("$Id: sha.c,v 1.14 1999/02/01 02:46:07 hubbe Exp $");
 
 #include <sha.h>
 
@@ -98,7 +98,7 @@ void pike_sha_exit(void)
 void pike_sha_init(void)
 {
   start_new_program();
-  add_storage(sizeof(struct sha_ctx));
+  ADD_STORAGE(struct sha_ctx);
   add_function("name", f_name, "function(void:string)", OPT_TRY_OPTIMIZE);
   add_function("create", f_create, "function(void|object:void)", 0);
   add_function("update", f_update, "function(string:object)", 0);
diff --git a/src/modules/_Image_TTF/image_ttf.c b/src/modules/_Image_TTF/image_ttf.c
index 920b813aad..65bbd957ec 100644
--- a/src/modules/_Image_TTF/image_ttf.c
+++ b/src/modules/_Image_TTF/image_ttf.c
@@ -1,12 +1,12 @@
 /*
- * $Id: image_ttf.c,v 1.8 1999/02/01 00:03:03 per Exp $
+ * $Id: image_ttf.c,v 1.9 1999/02/01 02:46:21 hubbe Exp $
  */
 
 #include "config.h"
 
 
 #include "global.h"
-RCSID("$Id: image_ttf.c,v 1.8 1999/02/01 00:03:03 per Exp $");
+RCSID("$Id: image_ttf.c,v 1.9 1999/02/01 02:46:21 hubbe Exp $");
 
 #ifdef HAVE_LIBTTF
 #include <freetype.h>
@@ -1278,7 +1278,7 @@ void pike_module_init(void)
       /* make face program */
 
       start_new_program();
-      add_storage(sizeof(struct image_ttf_face_struct));
+      ADD_STORAGE(struct image_ttf_face_struct);
 
       add_function("properties",image_ttf_face_properties,
 		   "function(:mapping)",0);
@@ -1298,7 +1298,7 @@ void pike_module_init(void)
       /* make face instance program */
 
       start_new_program();
-      add_storage(sizeof(struct image_ttf_faceinstance_struct));
+      ADD_STORAGE(struct image_ttf_faceinstance_struct);
       
       add_function("create",image_ttf_faceinstance_create,
 		   "function(object:void)",0);
diff --git a/src/modules/files/file.c b/src/modules/files/file.c
index c68b0c3073..d402c78c46 100644
--- a/src/modules/files/file.c
+++ b/src/modules/files/file.c
@@ -5,7 +5,7 @@
 \*/
 
 #include "global.h"
-RCSID("$Id: file.c,v 1.136 1999/01/31 20:35:04 grubba Exp $");
+RCSID("$Id: file.c,v 1.137 1999/02/01 02:46:41 hubbe Exp $");
 #include "fdlib.h"
 #include "interpret.h"
 #include "svalue.h"
@@ -2298,7 +2298,7 @@ static void init_file_locking(void)
 {
   INT32 off;
   start_new_program();
-  off=add_storage(sizeof(struct file_lock_key_storage));
+  off=ADD_STORAGE(struct file_lock_key_storage);
 #ifdef _REENTRANT
   map_variable("_owner","object",0,
 	       off + OFFSETOF(file_lock_key_storage, owner),
@@ -2391,7 +2391,7 @@ void pike_module_init(void)
   init_files_efuns();
 
   start_new_program();
-  add_storage(sizeof(struct my_file));
+  ADD_STORAGE(struct my_file);
 
 #define FILE_FUNC(X,Y,Z) PIKE_CONCAT(Y,_function_number)=add_function(X,Y,Z,0);
 #include "file_functions.h"
@@ -2429,7 +2429,7 @@ void pike_module_init(void)
   free_object(o);
   
   start_new_program();
-  add_storage(sizeof(struct object *));
+  ADD_STORAGE(struct object *);
   map_variable("_fd","object",0,0,T_OBJECT);
 
 #define FILE_FUNC(X,Y,Z) add_function(X,PIKE_CONCAT(Y,_ref),Z,0);
diff --git a/src/modules/files/socket.c b/src/modules/files/socket.c
index 1ff61217a2..d8e1663c9b 100644
--- a/src/modules/files/socket.c
+++ b/src/modules/files/socket.c
@@ -18,7 +18,7 @@
 #include "file_machine.h"
 #include "file.h"
 
-RCSID("$Id: socket.c,v 1.40 1998/11/22 11:08:06 hubbe Exp $");
+RCSID("$Id: socket.c,v 1.41 1999/02/01 02:46:43 hubbe Exp $");
 
 #ifdef HAVE_SYS_TYPE_H
 #include <sys/types.h>
@@ -395,7 +395,7 @@ void port_setup_program(void)
 {
   INT32 offset;
   start_new_program();
-  offset=add_storage(sizeof(struct port));
+  offset=ADD_STORAGE(struct port);
   map_variable("_accept_callback","mixed",0,offset+OFFSETOF(port,accept_callback),T_MIXED);
   map_variable("_id","mixed",0,offset+OFFSETOF(port,id),T_MIXED);
   add_function("bind",port_bind,"function(int,void|mixed,void|string:int)",0);
diff --git a/src/modules/spider/accesseddb.c b/src/modules/spider/accesseddb.c
index b3357afdf2..cee2c576db 100644
--- a/src/modules/spider/accesseddb.c
+++ b/src/modules/spider/accesseddb.c
@@ -1,5 +1,5 @@
 /*
- * $Id: accesseddb.c,v 1.16 1998/07/04 17:03:31 grubba Exp $
+ * $Id: accesseddb.c,v 1.17 1999/02/01 02:47:02 hubbe Exp $
  */
 
 #include "global.h"
@@ -18,7 +18,7 @@
 #include "error.h"
 #include "builtin_functions.h"
 
-RCSID("$Id: accesseddb.c,v 1.16 1998/07/04 17:03:31 grubba Exp $");
+RCSID("$Id: accesseddb.c,v 1.17 1999/02/01 02:47:02 hubbe Exp $");
 
 #include <stdio.h>
 
@@ -540,7 +540,7 @@ static void free_file_head(struct object *o)
 void init_accessdb_program(void)
 {
    start_new_program();
-   add_storage(sizeof(struct file_head));
+   ADD_STORAGE(struct file_head);
    add_function("create", f_create, "function(string:void)", ID_PUBLIC);
    add_function("add", f_add, "function(string,int ...:mapping(string:int))",
 		ID_PUBLIC);
diff --git a/src/modules/spider/dumudp.c b/src/modules/spider/dumudp.c
index 9b48141426..6083fa6afd 100644
--- a/src/modules/spider/dumudp.c
+++ b/src/modules/spider/dumudp.c
@@ -1,12 +1,12 @@
 /*
- * $Id: dumudp.c,v 1.41 1998/08/08 13:53:37 grubba Exp $
+ * $Id: dumudp.c,v 1.42 1999/02/01 02:47:03 hubbe Exp $
  */
 
 #include "global.h"
 
 #include "config.h"
 
-RCSID("$Id: dumudp.c,v 1.41 1998/08/08 13:53:37 grubba Exp $");
+RCSID("$Id: dumudp.c,v 1.42 1999/02/01 02:47:03 hubbe Exp $");
 #include "fdlib.h"
 #include "interpret.h"
 #include "svalue.h"
@@ -438,7 +438,7 @@ void init_udp(void)
 {
   start_new_program();
 
-  add_storage(sizeof(struct dumudp));
+  ADD_STORAGE(struct dumudp);
   add_function("bind",udp_bind,"function(int,void|function,void|string:int)",0);
   add_function("enable_broadcast", udp_enable_broadcast, "function(:void)", 0);
   add_function("read",udp_read,"function(int|void:mapping(string:int|string))",0);
diff --git a/src/modules/spider/xml.c b/src/modules/spider/xml.c
index ce7b910a36..c201fe2ca7 100644
--- a/src/modules/spider/xml.c
+++ b/src/modules/spider/xml.c
@@ -2284,7 +2284,7 @@ void init_xml(void)
 {
   INT32 off;
   start_new_program();
-  off=add_storage(sizeof(struct xmlobj));
+  off=ADD_STORAGE(struct xmlobj);
   map_variable("__entities","mapping",0,
 	       off + OFFSETOF(xmlobj, entities),T_MAPPING);
   map_variable("__attributes","mapping",0,
diff --git a/src/modules/system/nt.c b/src/modules/system/nt.c
index 96e8923705..6a211fa110 100644
--- a/src/modules/system/nt.c
+++ b/src/modules/system/nt.c
@@ -1,5 +1,5 @@
 /*
- * $Id: nt.c,v 1.6 1998/10/22 00:33:55 hubbe Exp $
+ * $Id: nt.c,v 1.7 1999/02/01 02:47:18 hubbe Exp $
  *
  * NT system calls for Pike
  *
@@ -529,7 +529,7 @@ void init_nt_system_calls(void)
       SIMPCONST(LOGON32_PROVIDER_DEFAULT);
       
       start_new_program();
-      add_storage(sizeof(HANDLE));
+      ADD_STORAGE(HANDLE);
       set_init_callback(init_token);
       set_exit_callback(exit_token);
       token_program=end_program();
diff --git a/src/object.c b/src/object.c
index ad2175ea54..15c766ece8 100644
--- a/src/object.c
+++ b/src/object.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: object.c,v 1.55 1999/01/31 09:01:56 hubbe Exp $");
+RCSID("$Id: object.c,v 1.56 1999/02/01 02:41:40 hubbe Exp $");
 #include "object.h"
 #include "dynamic_buffer.h"
 #include "interpret.h"
@@ -72,7 +72,7 @@ struct object *low_clone(struct program *p)
 
   GC_ALLOC();
 
-  o=(struct object *)xalloc( ((long)(((struct object *)0)->storage))+p->storage_needed);
+  o=(struct object *)xalloc( ((long)(((struct object *)0)->storage))+p->storage_needed+p->inherits[0].storage_offset);
 
   o->prog=p;
   add_ref(p);
diff --git a/src/operators.c b/src/operators.c
index e57e14d7c7..b102c8729e 100644
--- a/src/operators.c
+++ b/src/operators.c
@@ -5,7 +5,7 @@
 \*/
 #include "global.h"
 #include <math.h>
-RCSID("$Id: operators.c,v 1.44 1998/11/22 11:03:06 hubbe Exp $");
+RCSID("$Id: operators.c,v 1.45 1999/02/01 02:41:41 hubbe Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "multiset.h"
@@ -1992,7 +1992,7 @@ void init_operators(void)
 
 
   start_new_program();
-  add_storage(sizeof(struct string_assignment_storage));
+  ADD_STORAGE(struct string_assignment_storage);
   add_function("`[]",f_string_assignment_index,"function(int:int)",0);
   add_function("`[]=",f_string_assignment_assign_index,"function(int,int:int)",0);
   set_init_callback(init_string_assignment_storage);
diff --git a/src/pike_macros.h b/src/pike_macros.h
index 04c9ac87a8..106074c1d2 100644
--- a/src/pike_macros.h
+++ b/src/pike_macros.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: pike_macros.h,v 1.10 1999/01/31 22:22:05 grubba Exp $
+ * $Id: pike_macros.h,v 1.11 1999/02/01 02:41:42 hubbe Exp $
  */
 #ifndef MACROS_H
 #define MACROS_H
@@ -52,18 +52,12 @@
 #define isgraph(X)	(ispunct(X) || isupper(X) || islower(X) || isdigit(X))
 #endif /* !HAVE_ISGRAPH */
 
-/* FIXME: On some OS's sizeof(long long) is 8 and sizeof(char *) 4 bytes.
+/*
+ * #define ALIGNOF(X) __alignof__(X)
+ * #define ALIGNOF(X) (sizeof(X)>ALIGN_BOUND?ALIGN_BOUND:( 1<<my_log2(sizeof(X))))
  */
-#define ALIGN_BOUND 16 /* sizeof(char *) */
 
-#ifdef __GNUC__
-#define ALIGNOF(X) __alignof__(X)
-#define HAVE_ALIGNOF
-#else
-#define ALIGNOF(X) (sizeof(X)>ALIGN_BOUND?ALIGN_BOUND:( 1<<my_log2(sizeof(X))))
-#endif
+#define ALIGNOF(X) ((int)&(((struct { char ignored_ ; X fooo_; } *)0)->fooo_))
 
 #define DO_ALIGN(X,Y) (((long)(X)+((Y)-1)) & -(Y))
-#define MY_ALIGN(X) DO_ALIGN((X),ALIGN_BOUND)
-#define SMART_ALIGN(X,Y) DO_ALIGN((X),(Y)>ALIGN_BOUND? (((Y)-1) & ~(Y)) :ALIGN_BOUND)
 #endif
diff --git a/src/program.c b/src/program.c
index 2639b873e1..432c000183 100644
--- a/src/program.c
+++ b/src/program.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: program.c,v 1.107 1999/01/31 09:02:00 hubbe Exp $");
+RCSID("$Id: program.c,v 1.108 1999/02/01 02:41:43 hubbe Exp $");
 #include "program.h"
 #include "object.h"
 #include "dynamic_buffer.h"
@@ -488,6 +488,7 @@ struct program *low_allocate_program(void)
   struct program *p;
   p=ALLOC_STRUCT(program);
   MEMSET(p, 0, sizeof(struct program));
+  p->alignment_needed=1;
   
   GC_ALLOC();
   p->refs=1;
@@ -775,12 +776,7 @@ static int alignof_variable(int run_time_type)
   switch(run_time_type)
   {
     case T_FUNCTION:
-    case T_MIXED:
-#ifdef HAVE_ALIGNOF
-      return ALIGNOF(struct svalue);
-#else
-      return ALIGNOF(union anything);
-#endif
+    case T_MIXED: return ALIGNOF(struct svalue);
     case T_INT: return ALIGNOF(INT_TYPE);
     case T_FLOAT: return ALIGNOF(FLOAT_TYPE);
     default: return ALIGNOF(char *);
@@ -868,13 +864,6 @@ void check_program(struct program *p)
     if(p->inherits[e].storage_offset < 0)
       fatal("Inherit->storage_offset is wrong.\n");
 
-#if 0
-    /* This test doesn't really work... */
-    if(p->inherits[e].storage_offset & (ALIGN_BOUND-1))
-    {
-      fatal("inherit[%d].storage_offset is not properly aligned (%d).\n",e,p->inherits[e].storage_offset);
-    }
-#endif
   }
 }
 #endif
@@ -981,24 +970,31 @@ struct program *debug_end_program(void)
  * Allocate needed for this program in the object structure.
  * An offset to the data is returned.
  */
-SIZE_T low_add_storage(SIZE_T size, SIZE_T alignment)
+SIZE_T low_add_storage(SIZE_T size, SIZE_T alignment, int modulo)
 {
   SIZE_T offset;
-  offset=DO_ALIGN(new_program->storage_needed, alignment);
+#ifdef PIKE_DEBUG
+  if(alignment <=0 || (alignment & (alignment-1)) || alignment > 256)
+    fatal("Alignment must be 1,2,4,8,16,32,64,128 or 256 not %d\n",alignment);
+#endif
+  offset=DO_ALIGN(OFFSETOF(object,storage)+
+		  new_program->storage_needed,
+		  alignment)+modulo-OFFSETOF(object,storage);
+
+  if(!new_program->storage_needed)
+    new_program->inherits[0].storage_offset=offset;
+
+  if(new_program->alignment_needed<alignment)
+    new_program->alignment_needed=alignment;
+
   new_program->storage_needed = offset + size;
 #ifdef PIKE_DEBUG
-  if(alignment <=0) fatal("Alignment must be at least 1\n");
   if(new_program->storage_needed<0)
     fatal("add_storage failed horribly!\n");
 #endif
   return offset;
 }
 
-SIZE_T add_storage(SIZE_T storage)
-{
-  return low_add_storage(storage,
-			 storage>ALIGN_BOUND? ALIGN_BOUND : storage ? (1<<my_log2(storage)) : 1);
-}
 
 /*
  * set a callback used to initialize clones of this program
@@ -1162,7 +1158,11 @@ void low_inherit(struct program *p,
 
   inherit_offset = new_program->num_inherits;
 
-  storage_offset=add_storage(p->storage_needed);
+  /* alignment magic */
+  storage_offset=p->inherits[0].storage_offset % p->alignment_needed;
+  storage_offset=low_add_storage(p->storage_needed,
+				 p->alignment_needed,
+				 storage_offset)-storage_offset;
 
   for(e=0; e<(int)p->num_inherits; e++)
   {
@@ -1520,7 +1520,7 @@ int define_variable(struct pike_string *name,
   
   n=low_define_variable(name,type,flags,
 			low_add_storage(sizeof_variable(run_time_type),
-					alignof_variable(run_time_type)),
+					alignof_variable(run_time_type),0),
 			run_time_type);
   
 
@@ -2406,6 +2406,8 @@ void check_all_programs(void)
 }
 #endif
 
+#undef THIS
+#define THIS ((struct pike_trampoline *)(fp->current_storage))
 struct program *pike_trampoline_program=0;
 
 static void apply_trampoline(INT32 args)
@@ -2413,11 +2415,66 @@ static void apply_trampoline(INT32 args)
   error("Internal error: Trampoline magic failed!\n");
 }
 
+static void init_trampoline(struct object *o)
+{
+  THIS->frame=0;
+}
+
+static void exit_trampoline(struct object *o)
+{
+  if(THIS->frame)
+  {
+    free_pike_frame(THIS->frame);
+    THIS->frame=0;
+  }
+}
+
+static void gc_check_frame(struct pike_frame *f)
+{
+  if(!f) return;
+  if(!debug_gc_check(f,T_UNKNOWN,f) && f->malloced_locals)
+  {
+    if(f->current_object) gc_check(f->current_object);
+    if(f->context.prog)   gc_check(f->context.prog);
+    if(f->context.parent) gc_check(f->context.parent);
+    gc_check_svalues(f->locals,f->num_locals);
+    if(f->scope)          gc_check_frame(f->scope);
+  }
+}
+
+static void gc_check_trampoline(struct object *o)
+{
+  gc_check_frame(THIS->frame);
+}
+
+static void gc_mark_frame(struct pike_frame *f)
+{
+  if(!f) return;
+  if(gc_mark(f))
+  {
+    if(f->current_object) gc_mark_object_as_referenced(f->current_object);
+    if(f->context.prog)   gc_mark_program_as_referenced(f->context.prog);
+    if(f->context.parent) gc_mark_object_as_referenced(f->context.parent);
+    if(f->malloced_locals)gc_mark_svalues(f->locals,f->num_locals);
+    if(f->scope)          gc_mark_frame(f->scope);
+  }
+}
+
+static void gc_mark_trampoline(struct object *o)
+{
+  gc_mark_frame(THIS->frame);
+}
+
+
 void init_program(void)
 {
   start_new_program();
-  add_storage(sizeof(struct pike_trampoline));
+  ADD_STORAGE(struct pike_trampoline);
   add_function("`()",apply_trampoline,"function(mixed...:mixed)",0);
+  set_init_callback(init_trampoline);
+  set_exit_callback(exit_trampoline);
+  set_gc_check_callback(gc_check_trampoline);
+  set_gc_mark_callback(gc_mark_trampoline);
   pike_trampoline_program=end_program();
 }
 
diff --git a/src/program.h b/src/program.h
index 67b9f9b5a3..50ba895c6f 100644
--- a/src/program.h
+++ b/src/program.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: program.h,v 1.48 1999/01/31 09:02:02 hubbe Exp $
+ * $Id: program.h,v 1.49 1999/02/01 02:41:45 hubbe Exp $
  */
 #ifndef PROGRAM_H
 #define PROGRAM_H
@@ -13,6 +13,7 @@
 #include <stdarg.h>
 #include "global.h"
 #include "pike_types.h"
+#include "pike_macros.h"
 #include "svalue.h"
 #include "time_stuff.h"
 
@@ -193,6 +194,7 @@ struct program
   INT32 id;             /* used to identify program in caches */
   INT32 flags;
   INT32 storage_needed; /* storage needed in the object struct */
+  unsigned INT8 alignment_needed;
   struct timeval timestamp;
 
   struct program *next;
@@ -250,6 +252,8 @@ extern struct program *pike_trampoline_program;
 
 #define COMPILER_IN_CATCH 1
 
+#define ADD_STORAGE(X) low_add_storage(sizeof(X), ALIGNOF(X),0)
+
 #define FOO(NUMTYPE,TYPE,NAME) void PIKE_CONCAT(add_to_,NAME(TYPE ARG));
 #include "program_areas.h"
 
@@ -275,8 +279,7 @@ int sizeof_variable(int run_time_type);
 void check_program(struct program *p);
 struct program *end_first_pass(int finish);
 struct program *debug_end_program(void);
-SIZE_T low_add_storage(SIZE_T size, SIZE_T alignment);
-SIZE_T add_storage(SIZE_T storage);
+SIZE_T low_add_storage(SIZE_T size, SIZE_T alignment, int modulo);
 void set_init_callback(void (*init)(struct object *));
 void set_exit_callback(void (*exit)(struct object *));
 void set_gc_mark_callback(void (*m)(struct object *));
diff --git a/src/security.c b/src/security.c
index 188cf813c9..e53c6b1652 100644
--- a/src/security.c
+++ b/src/security.c
@@ -140,7 +140,7 @@ void init_pike_security(void)
   start_new_program();
 
   start_new_program();
-  add_storage(sizeof(struct pike_creds));
+  ADD_STORAGE(struct pike_creds);
   add_function("set_default_creds",set_default_creds,"function(object:void)",0);
   add_function("get_default_creds",get_default_creds,"function(:object)",0);
   add_function("init_creds",init_creds,"function(object,int,int:void)",0);
diff --git a/src/signal_handler.c b/src/signal_handler.c
index b188c11f6c..2f1ff6e6ee 100644
--- a/src/signal_handler.c
+++ b/src/signal_handler.c
@@ -23,7 +23,7 @@
 #include "builtin_functions.h"
 #include <signal.h>
 
-RCSID("$Id: signal_handler.c,v 1.101 1999/01/16 01:32:06 hubbe Exp $");
+RCSID("$Id: signal_handler.c,v 1.102 1999/02/01 02:41:47 hubbe Exp $");
 
 #ifdef HAVE_PASSWD_H
 # include <passwd.h>
@@ -2262,7 +2262,7 @@ void init_signals(void)
 #endif
 
   start_new_program();
-  add_storage(sizeof(struct pid_status));
+  ADD_STORAGE(struct pid_status);
   set_init_callback(init_pid_status);
   set_exit_callback(exit_pid_status);
   add_function("wait",f_pid_status_wait,"function(:int)",0);
diff --git a/src/stralloc.c b/src/stralloc.c
index 90d8174b9f..04eefb1ebb 100644
--- a/src/stralloc.c
+++ b/src/stralloc.c
@@ -15,7 +15,7 @@
 
 #include <ctype.h>
 
-RCSID("$Id: stralloc.c,v 1.52 1998/12/20 09:24:26 hubbe Exp $");
+RCSID("$Id: stralloc.c,v 1.53 1999/02/01 02:41:48 hubbe Exp $");
 
 #define BEGIN_HASH_SIZE 997
 #define MAX_AVG_LINK_LENGTH 3
@@ -658,9 +658,9 @@ struct pike_string *add_string_status(int verbose)
       for(p=base_table[e];p;p=p->next)
       {
 	num_distinct_strings++;
-	bytes_distinct_strings+=MY_ALIGN(p->len);
+	bytes_distinct_strings+=DO_ALIGN(p->len,sizeof(void *));
 	allocd_strings+=p->refs;
-	allocd_bytes+=p->refs*MY_ALIGN(p->len+3);
+	allocd_bytes+=p->refs*DO_ALIGN(p->len+3,sizeof(void *));
       }
 
     }
diff --git a/src/threads.c b/src/threads.c
index 065b35735c..a6df23e7ae 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -1,5 +1,5 @@
 #include "global.h"
-RCSID("$Id: threads.c,v 1.86 1999/01/21 09:15:19 hubbe Exp $");
+RCSID("$Id: threads.c,v 1.87 1999/02/01 02:41:50 hubbe Exp $");
 
 int num_threads = 1;
 int threads_disabled = 0;
@@ -990,7 +990,7 @@ void th_init(void)
   add_efun("thread_local",f_thread_local,"function(:object)",OPT_SIDE_EFFECT);
 
   start_new_program();
-  add_storage(sizeof(struct mutex_storage));
+  ADD_STORAGE(struct mutex_storage);
   add_function("lock",f_mutex_lock,"function(int|void:object)",0);
   add_function("trylock",f_mutex_trylock,"function(int|void:object)",0);
   set_init_callback(init_mutex_obj);
@@ -998,7 +998,7 @@ void th_init(void)
   end_class("mutex", 0);
 
   start_new_program();
-  mutex_key_offset = add_storage(sizeof(struct key_storage));
+  mutex_key_offset = ADD_STORAGE(struct key_storage);
   /* This is needed to allow the gc to find the possible circular reference.
    * It also allows a process to take over ownership of a key.
    */
@@ -1014,7 +1014,7 @@ void th_init(void)
 #endif
 
   start_new_program();
-  add_storage(sizeof(COND_T));
+  ADD_STORAGE(COND_T);
   add_function("wait",f_cond_wait,"function(void|object:void)",0);
   add_function("signal",f_cond_signal,"function(:void)",0);
   add_function("broadcast",f_cond_broadcast,"function(:void)",0);
@@ -1034,7 +1034,7 @@ void th_init(void)
   }
 
   start_new_program();
-  add_storage(sizeof(struct thread_local));
+  ADD_STORAGE(struct thread_local);
   add_function("get",f_thread_local_get,"function(:mixed)",0);
   add_function("set",f_thread_local_set,"function(mixed:mixed)",0);
   thread_local_prog=end_program();
@@ -1042,7 +1042,7 @@ void th_init(void)
     fatal("Failed to initialize thread_local program!\n");
 
   start_new_program();
-  add_storage(sizeof(struct thread_state));
+  ADD_STORAGE(struct thread_state);
   thread_id_result_variable=simple_add_variable("result","mixed",0);
   add_function("backtrace",f_thread_backtrace,"function(:array)",0);
   add_function("wait",f_thread_id_result,"function(:mixed)",0);
-- 
GitLab