]> granicus.if.org Git - yasm/commitdiff
Integrate ternary search trees into build.
authorPeter Johnson <peter@tortall.net>
Sun, 23 Sep 2001 23:12:51 +0000 (23:12 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 23 Sep 2001 23:12:51 +0000 (23:12 -0000)
svn path=/trunk/yasm/; revision=216

src/Makefile.am
src/ternary.c
src/ternary.h

index f97493d8296a050754c93183096f89c3af61e578..c5d0c9198fb75aa3c0851e1288c7592e004b1f33 100644 (file)
@@ -39,6 +39,8 @@ libyasm_a_SOURCES = \
        parser.c                \
        parser.h                \
        optimizer.h             \
+       ternary.c               \
+       ternary.h               \
        strcasecmp.c
 
 CFLAGS = @ANSI_CFLAGS@
index c5ef3a58b7638b00f7bec0cbf4d50e1f03e2836a..addd3fa98a821c3714934aee3516ab7d6faa7b42 100644 (file)
 #include "config.h"
 #endif
 
-#ifdef HAVE_STDLIB_H
+#include "util.h"
+
+#include <stdio.h>
+
+#ifdef STDC_HEADERS
 #include <stdlib.h>
 #endif
 
-#include <stdio.h>
+#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;
index 2e0c828503050fb3f2e780956ec4d847d1115bf4..add954763601cf56d8c422edce70851d2cddd0e3 100644 (file)
@@ -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;