diff options
author | Christopher R. Hertel <crh@samba.org> | 1998-05-21 17:14:20 +0000 |
---|---|---|
committer | Christopher R. Hertel <crh@samba.org> | 1998-05-21 17:14:20 +0000 |
commit | cbb1ef38b5bee7dddf4cfaad7ef69792ec003d8d (patch) | |
tree | b0845888c5c5ef14f8bd9b101a768d03634cfb6c /source3 | |
parent | cf76b415a34534f574664e1fc1f8f1f8e6511c95 (diff) | |
download | samba-cbb1ef38b5bee7dddf4cfaad7ef69792ec003d8d.tar.gz samba-cbb1ef38b5bee7dddf4cfaad7ef69792ec003d8d.tar.bz2 samba-cbb1ef38b5bee7dddf4cfaad7ef69792ec003d8d.zip |
Along the lines that Andrew suggested, I added a header called ubi_null.h.
This header tries four different locations for a definition of NULL. If
NULL still hasn't been found, it defaults to ((void *)0). All of the
includes can be, essentially, overridden by defining NULL on the command
line, as in -DNULL=((void *)0). I have faith that this will avoid the
problem of NULL being in different places on different systems. If there
is a system out there that doesn't define NULL in any of the headers I've
included, then let me know *where* it's defined and I'll add another
header. Chris -)-----
(This used to be commit 05fcc678729999f249b97460a579bdc218028a47)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/ubiqx/ubi_AVLtree.c | 15 | ||||
-rw-r--r-- | source3/ubiqx/ubi_AVLtree.h | 5 | ||||
-rw-r--r-- | source3/ubiqx/ubi_BinTree.c | 26 | ||||
-rw-r--r-- | source3/ubiqx/ubi_BinTree.h | 17 | ||||
-rw-r--r-- | source3/ubiqx/ubi_Cache.c | 17 | ||||
-rw-r--r-- | source3/ubiqx/ubi_Cache.h | 5 | ||||
-rw-r--r-- | source3/ubiqx/ubi_SplayTree.c | 15 | ||||
-rw-r--r-- | source3/ubiqx/ubi_SplayTree.h | 5 | ||||
-rw-r--r-- | source3/ubiqx/ubi_dLinkList.c | 9 | ||||
-rw-r--r-- | source3/ubiqx/ubi_dLinkList.h | 7 | ||||
-rw-r--r-- | source3/ubiqx/ubi_null.h | 92 | ||||
-rw-r--r-- | source3/ubiqx/ubi_sLinkList.c | 8 | ||||
-rw-r--r-- | source3/ubiqx/ubi_sLinkList.h | 7 |
13 files changed, 184 insertions, 44 deletions
diff --git a/source3/ubiqx/ubi_AVLtree.c b/source3/ubiqx/ubi_AVLtree.c index 8f7cb29764..f2ed7f2854 100644 --- a/source3/ubiqx/ubi_AVLtree.c +++ b/source3/ubiqx/ubi_AVLtree.c @@ -31,7 +31,10 @@ * * -------------------------------------------------------------------------- ** * - * Log: ubi_AVLtree.c,v + * Log: ubi_AVLtree.c,v + * Revision 4.1 1998/05/20 04:35:50 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * * Revision 4.0 1998/03/10 03:37:09 crh * Major changes. * By adding the AVL balance field to the base ubi_btNode structure, I no @@ -128,17 +131,17 @@ * ========================================================================= ** */ -#include "../includes.h" -#include "ubi_AVLtree.h" /* Header for THIS module. */ +#include "ubi_null.h" /* ubiqx NULL source. */ +#include "ubi_AVLtree.h" /* Header for THIS module. */ /* ========================================================================== ** * Static data. */ static char ModuleID[] = "ubi_AVLtree\n\ -\tRevision: 4.0\n\ -\tDate: 1998/03/10 03:37:09\n\ -\tAuthor: crh\n"; +\tRevision: 4.1 \n\ +\tDate: 1998/05/20 04:35:50 \n\ +\tAuthor: crh \n"; /* ========================================================================== ** * The next set of functions are the AVL balancing routines. There are left diff --git a/source3/ubiqx/ubi_AVLtree.h b/source3/ubiqx/ubi_AVLtree.h index f99a78aa26..c70190cb62 100644 --- a/source3/ubiqx/ubi_AVLtree.h +++ b/source3/ubiqx/ubi_AVLtree.h @@ -34,7 +34,10 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * -------------------------------------------------------------------------- ** - * Log: ubi_AVLtree.h,v + * Log: ubi_AVLtree.h,v + * Revision 4.1 1998/05/20 04:35:50 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * * Revision 4.0 1998/03/10 03:34:45 crh * Major changes. * By adding the AVL balance field to the base ubi_btNode structure, I no diff --git a/source3/ubiqx/ubi_BinTree.c b/source3/ubiqx/ubi_BinTree.c index 16640f278e..d60bcafe8d 100644 --- a/source3/ubiqx/ubi_BinTree.c +++ b/source3/ubiqx/ubi_BinTree.c @@ -26,7 +26,14 @@ * * -------------------------------------------------------------------------- ** * - * Log: ubi_BinTree.c,v + * Log: ubi_BinTree.c,v + * Revision 4.2 1998/05/20 04:32:36 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * Also, the balance and gender fields of the node were declared as + * signed char. As I understand it, at least one SunOS or Solaris + * compiler doesn't like "signed char". The declarations were + * wrong anyway, so I changed them to simple "char". + * * Revision 4.1 1998/03/31 06:11:57 crh * Thomas Aglassinger sent E'mail pointing out errors in the * dereferencing of function pointers, and a missing typecast. @@ -122,18 +129,17 @@ * ========================================================================== ** */ -#include "../includes.h" -#include "ubi_BinTree.h" /* Header for this module */ - +#include "ubi_null.h" /* ubiqx NULL source. */ +#include "ubi_BinTree.h" /* Header for this module. */ /* ========================================================================== ** * Static data. */ static char ModuleID[] = "ubi_BinTree\n\ -\tRevision: 4.1\n\ -\tDate: 1998/03/31 06:11:57\n\ -\tAuthor: crh\n"; +\tRevision: 4.2 \n\ +\tDate: 1998/05/20 04:32:36 \n\ +\tAuthor: crh \n"; /* ========================================================================== ** * Internal (private) functions. @@ -206,14 +212,14 @@ static ubi_btNodePtr TreeFind( ubi_btItemPtr findme, { register ubi_btNodePtr tmp_p = p; ubi_btNodePtr tmp_pp = NULL; - signed char tmp_gender = ubi_trEQUAL; + char tmp_gender = ubi_trEQUAL; int tmp_cmp; while( tmp_p && (ubi_trEQUAL != (tmp_cmp = ubi_trAbNormal((*CmpFunc)(findme, tmp_p)))) ) { tmp_pp = tmp_p; /* Keep track of previous node. */ - tmp_gender = (signed char)tmp_cmp; /* Keep track of sex of child. */ + tmp_gender = (char)tmp_cmp; /* Keep track of sex of child. */ tmp_p = tmp_p->Link[tmp_cmp]; /* Go to child. */ } *parentp = tmp_pp; /* Return results. */ @@ -477,7 +483,7 @@ ubi_btNodePtr ubi_btInitNode( ubi_btNodePtr NodePtr ) ubi_btRootPtr ubi_btInitTree( ubi_btRootPtr RootPtr, ubi_btCompFunc CompFunc, - unsigned char Flags ) + char Flags ) /* ------------------------------------------------------------------------ ** * Initialize the fields of a Tree Root header structure. * diff --git a/source3/ubiqx/ubi_BinTree.h b/source3/ubiqx/ubi_BinTree.h index 8a99f28045..609566fe3a 100644 --- a/source3/ubiqx/ubi_BinTree.h +++ b/source3/ubiqx/ubi_BinTree.h @@ -28,7 +28,14 @@ * * -------------------------------------------------------------------------- ** * - * Log: ubi_BinTree.h,v + * Log: ubi_BinTree.h,v + * Revision 4.2 1998/05/20 04:32:36 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * Also, the balance and gender fields of the node were declared as + * signed char. As I understand it, at least one SunOS or Solaris + * compiler doesn't like "signed char". The declarations were + * wrong anyway, so I changed them to simple "char". + * * Revision 4.1 1998/03/31 06:13:47 crh * Thomas Aglassinger sent E'mail pointing out errors in the * dereferencing of function pointers, and a missing typecast. @@ -263,8 +270,8 @@ typedef void *ubi_btItemPtr; /* A pointer to key data within a node. */ */ typedef struct ubi_btNodeStruct { struct ubi_btNodeStruct *Link[ 3 ]; - signed char gender; - signed char balance; + char gender; + char balance; } ubi_btNode; typedef ubi_btNode *ubi_btNodePtr; /* Pointer to an ubi_btNode structure. */ @@ -326,7 +333,7 @@ typedef struct { ubi_btNodePtr root; /* A pointer to the root node of the tree */ ubi_btCompFunc cmp; /* A pointer to the tree's comparison function */ unsigned long count; /* A count of the number of nodes in the tree */ - unsigned char flags; /* Overwrite Y|N, Duplicate keys Y|N... */ + char flags; /* Overwrite Y|N, Duplicate keys Y|N... */ } ubi_btRoot; typedef ubi_btRoot *ubi_btRootPtr; /* Pointer to an ubi_btRoot structure. */ @@ -367,7 +374,7 @@ ubi_btNodePtr ubi_btInitNode( ubi_btNodePtr NodePtr ); ubi_btRootPtr ubi_btInitTree( ubi_btRootPtr RootPtr, ubi_btCompFunc CompFunc, - unsigned char Flags ); + char Flags ); /* ------------------------------------------------------------------------ ** * Initialize the fields of a Tree Root header structure. * diff --git a/source3/ubiqx/ubi_Cache.c b/source3/ubiqx/ubi_Cache.c index 290f7593e7..af2fe7b78d 100644 --- a/source3/ubiqx/ubi_Cache.c +++ b/source3/ubiqx/ubi_Cache.c @@ -90,20 +90,31 @@ * * -------------------------------------------------------------------------- ** * - * Log: ubi_Cache.c,v + * Log: ubi_Cache.c,v + * Revision 0.1 1998/05/20 04:36:02 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * * Revision 0.0 1997/12/18 06:24:33 crh * Initial Revision. * * ========================================================================== ** */ -#include "../includes.h" -#include "ubi_Cache.h" /* Header for *this* module. */ +#include "ubi_null.h" /* ubiqx NULL source. */ +#include "ubi_Cache.h" /* Header for *this* module. */ /* -------------------------------------------------------------------------- ** * Static data... */ +/* commented out until I make use of it... +static char ModuleID[] = +"ubi_Cache\n\ +\tRevision: 0.1 \n\ +\tDate: 1998/05/20 04:36:02 \n\ +\tAuthor: crh \n"; +*/ + /* -------------------------------------------------------------------------- ** * Internal functions... */ diff --git a/source3/ubiqx/ubi_Cache.h b/source3/ubiqx/ubi_Cache.h index eddd6a4bf8..e4e2bf0542 100644 --- a/source3/ubiqx/ubi_Cache.h +++ b/source3/ubiqx/ubi_Cache.h @@ -92,7 +92,10 @@ * * -------------------------------------------------------------------------- ** * - * Log: ubi_Cache.h,v + * Log: ubi_Cache.h,v + * Revision 0.1 1998/05/20 04:36:02 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * * Revision 0.0 1997/12/18 06:25:23 crh * Initial Revision. * diff --git a/source3/ubiqx/ubi_SplayTree.c b/source3/ubiqx/ubi_SplayTree.c index 7bc1070bc7..a0d638ecc7 100644 --- a/source3/ubiqx/ubi_SplayTree.c +++ b/source3/ubiqx/ubi_SplayTree.c @@ -36,7 +36,10 @@ * * -------------------------------------------------------------------------- ** * - * Log: ubi_SplayTree.c,v + * Log: ubi_SplayTree.c,v + * Revision 4.1 1998/05/20 04:37:54 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * * Revision 4.0 1998/03/10 03:41:33 crh * Minor comment changes. The revision number is now 4.0 to match the * BinTree and AVLtree modules. @@ -123,17 +126,17 @@ * ========================================================================== ** */ -#include "../includes.h" -#include "ubi_SplayTree.h" /* Header for THIS module. */ +#include "ubi_null.h" /* ubiqx NULL source. */ +#include "ubi_SplayTree.h" /* Header for THIS module. */ /* ========================================================================== ** * Static data. */ static char ModuleID[] = "ubi_SplayTree\n\ -\tRevision: 4.0\n\ -\tDate: 1998/03/10 03:41:33\n\ -\tAuthor: crh\n"; +\tRevision: 4.1 \n\ +\tDate: 1998/05/20 04:37:54 \n\ +\tAuthor: crh \n"; /* ========================================================================== ** diff --git a/source3/ubiqx/ubi_SplayTree.h b/source3/ubiqx/ubi_SplayTree.h index 9e55734702..800f53d884 100644 --- a/source3/ubiqx/ubi_SplayTree.h +++ b/source3/ubiqx/ubi_SplayTree.h @@ -38,7 +38,10 @@ * * -------------------------------------------------------------------------- ** * - * Log: ubi_SplayTree.h,v + * Log: ubi_SplayTree.h,v + * Revision 4.1 1998/05/20 04:37:54 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * * Revision 4.0 1998/03/10 03:40:57 crh * Minor comment changes. The revision number is now 4.0 to match the * BinTree and AVLtree modules. diff --git a/source3/ubiqx/ubi_dLinkList.c b/source3/ubiqx/ubi_dLinkList.c index 65c11d225d..405cfcb6af 100644 --- a/source3/ubiqx/ubi_dLinkList.c +++ b/source3/ubiqx/ubi_dLinkList.c @@ -24,7 +24,10 @@ * * -------------------------------------------------------------------------- ** * - * Log: ubi_dLinkList.c,v + * Log: ubi_dLinkList.c,v + * Revision 0.6 1998/05/20 04:38:05 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * * Revision 0.5 1998/03/10 02:55:00 crh * Simplified the code and added macros for stack & queue manipulations. * @@ -52,8 +55,8 @@ * ========================================================================== ** */ -#include "../includes.h" -#include "ubi_dLinkList.h" +#include "ubi_null.h" /* ubiqx NULL source. */ +#include "ubi_dLinkList.h" /* Header for *this* module. */ /* ========================================================================== ** * Functions... diff --git a/source3/ubiqx/ubi_dLinkList.h b/source3/ubiqx/ubi_dLinkList.h index 9c6a3be2e2..0bc6a62dd4 100644 --- a/source3/ubiqx/ubi_dLinkList.h +++ b/source3/ubiqx/ubi_dLinkList.h @@ -26,7 +26,10 @@ * * -------------------------------------------------------------------------- ** * - * Log: ubi_dLinkList.h,v + * Log: ubi_dLinkList.h,v + * Revision 0.6 1998/05/20 04:38:05 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * * Revision 0.5 1998/03/10 02:54:04 crh * Simplified the code and added macros for stack & queue manipulations. * @@ -54,8 +57,6 @@ * ========================================================================== ** */ -#include <stdlib.h> - /* ========================================================================== ** * Typedefs... diff --git a/source3/ubiqx/ubi_null.h b/source3/ubiqx/ubi_null.h new file mode 100644 index 0000000000..c5cab418ac --- /dev/null +++ b/source3/ubiqx/ubi_null.h @@ -0,0 +1,92 @@ +#ifndef UBI_NULL_H +#define UBI_NULL_H +/* ========================================================================== ** + * ubi_null.h + * + * Copyright (C) 1998 by Christopher R. Hertel + * + * Email: crh@ubiqx.mn.org + * -------------------------------------------------------------------------- ** + * This header provides declarations and data types used internally by the + * ubiqx modules. It is not intended to be included elsewhere. + * -------------------------------------------------------------------------- ** + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * -------------------------------------------------------------------------- ** + * + * You don't need this in your code. It is used by the ubi_*.c files. + * At present, its only purpose is to provide a definition of NULL. + * Read on... + * + * -------------------------------------------------------------------------- ** + * + * Log: ubi_null.h,v + * Revision 0.0 1998/05/20 04:38:38 crh + * Initial Revision. + * + * ========================================================================== ** + */ + +/* -------------------------------------------------------------------------- ** + * Looking for NULL. + * + * The core ubiqx modules (all those beginning with 'ubi_') rely on very + * little from the outside world. One exception is that we need a + * defintion for NULL. This has turned out to be something of a problem, + * as NULL is NOT always defined in the same place on different systems. + * + * Ahh... standards... + * + * K&R 2nd Ed. (pg 102) says NULL should be in <stdio.h>. I've heard + * that it is in <locale.h> on some systems. I've also seen it in + * <stddef.h> and <stdlib.h>. In most cases it's defined in multiple + * places. We'll try several of them. If none of these work on your + * system, please send E'mail and let me know where you get your NULL! + * + * The purpose of the mess below, then, is simply to supply a definition + * of NULL to the ubi_*.c files. Keep in mind that C compilers (all + * those of which I'm aware) will allow you to define a constant on the + * command line, eg.: -DNULL=((void *)0). + * + * Also, 99.9% of the time, NULL is zero. I have been informed of at + * least one exception. + * + * crh; may 1998 + */ + +#ifndef NULL +#include <stddef.h> +#endif + +#ifndef NULL +#include <stdlib.h> +#endif + +#ifndef NULL +#include <stdio.h> +#endif + +#ifndef NULL +#include <locale.h> +#endif + +#ifndef NULL +#define NULL ((void *)0) +#endif + +/* ================================ The End ================================= */ +#endif /* UBI_NULL_H */ + diff --git a/source3/ubiqx/ubi_sLinkList.c b/source3/ubiqx/ubi_sLinkList.c index 3dc4f0640c..d1cdb10416 100644 --- a/source3/ubiqx/ubi_sLinkList.c +++ b/source3/ubiqx/ubi_sLinkList.c @@ -24,7 +24,10 @@ * * -------------------------------------------------------------------------- ** * - * Log: ubi_sLinkList.c,v + * Log: ubi_sLinkList.c,v + * Revision 0.5 1998/05/20 04:38:05 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * * Revision 0.4 1998/03/10 02:23:20 crh * Combined ubi_StackQueue and ubi_sLinkList into one module. Redesigned * the functions and macros. Not a complete rewrite but close to it. @@ -72,7 +75,8 @@ * ========================================================================== ** */ -#include "ubi_sLinkList.h" +#include "ubi_null.h" /* ubiqx NULL source. */ +#include "ubi_sLinkList.h" /* Header for *this* module. */ /* ========================================================================== ** * Functions... diff --git a/source3/ubiqx/ubi_sLinkList.h b/source3/ubiqx/ubi_sLinkList.h index 2275d852da..03ab4f9836 100644 --- a/source3/ubiqx/ubi_sLinkList.h +++ b/source3/ubiqx/ubi_sLinkList.h @@ -26,7 +26,10 @@ * * -------------------------------------------------------------------------- ** * - * Log: ubi_sLinkList.h,v + * Log: ubi_sLinkList.h,v + * Revision 0.5 1998/05/20 04:38:05 crh + * The C file now includes ubi_null.h. See ubi_null.h for more info. + * * Revision 0.4 1998/03/10 02:22:39 crh * Combined ubi_StackQueue and ubi_sLinkList into one module. Redesigned * the functions and macros. Not a complete rewrite but close to it. @@ -74,8 +77,6 @@ * ========================================================================== ** */ -#include <stdlib.h> - /* ========================================================================== ** * Typedefs... |