From b253f75170336c9ce976000088827ce950ec61a8 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 23 Sep 2001 23:12:51 +0000 Subject: [PATCH] Integrate ternary search trees into build. svn path=/trunk/yasm/; revision=216 --- src/Makefile.am | 2 ++ src/ternary.c | 15 +++++++++++---- src/ternary.h | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index f97493d8..c5d0c919 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,6 +39,8 @@ libyasm_a_SOURCES = \ parser.c \ parser.h \ optimizer.h \ + ternary.c \ + ternary.h \ strcasecmp.c CFLAGS = @ANSI_CFLAGS@ diff --git a/src/ternary.c b/src/ternary.c index c5ef3a58..addd3fa9 100644 --- a/src/ternary.c +++ b/src/ternary.c @@ -21,15 +21,20 @@ #include "config.h" #endif -#ifdef HAVE_STDLIB_H +#include "util.h" + +#include + +#ifdef STDC_HEADERS #include #endif -#include +#include "errwarn.h" -#include "libiberty.h" #include "ternary.h" +RCSID("$IdPath$"); + /* Non-recursive so we don't waste stack space/time on large insertions. */ @@ -74,7 +79,9 @@ ternary_insert (ternary_tree * root, char *s, void *data, int replace) for (;;) { /* Allocate the memory for the node, and fill it in */ - *pcurr = (ternary_tree) xmalloc (sizeof (ternary_node)); + *pcurr = (ternary_tree) malloc (sizeof (ternary_node)); + if (!*pcurr) + Fatal(FATAL_NOMEM); curr = *pcurr; curr->splitchar = *s; curr->lokid = curr->hikid = curr->eqkid = 0; diff --git a/src/ternary.h b/src/ternary.h index 2e0c8285..add95476 100644 --- a/src/ternary.h +++ b/src/ternary.h @@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef TERNARY_H_ -#define TERNARY_H_ +#ifndef YASM_TERNARY_H +#define YASM_TERNARY_H /* Ternary search trees */ typedef struct ternary_node_def *ternary_tree; -- 2.40.0