#include <inttypes.h>
#include <math.h>
#include <obstack.h>
-#include <search.h>
+#include <eu-search.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
struct synonym *newp = xmalloc (sizeof (*newp));
newp->from = $2;
newp->to = $3;
- if (tfind (newp, &synonyms, compare_syn) != NULL)
+ if (eu_tfind (newp, &synonyms, compare_syn) != NULL)
error (0, 0,
"%d: duplicate definition for synonym '%s'",
i386_lineno, $2);
- else if (tsearch ( newp, &synonyms, compare_syn) == NULL)
- error (EXIT_FAILURE, 0, "tsearch");
+ else if (eu_tsearch ( newp, &synonyms, compare_syn) == NULL)
+ error (EXIT_FAILURE, 0, "eu_tsearch");
}
|
;
newp->bytes = $1;
newp->mnemonic = $4;
if (newp->mnemonic != (void *) -1l
- && tfind ($4, &mnemonics,
+ && eu_tfind ($4, &mnemonics,
(int (*)(const void *, const void *)) strcmp) == NULL)
{
- if (tsearch ($4, &mnemonics,
+ if (eu_tsearch ($4, &mnemonics,
(int (*)(const void *, const void *)) strcmp) == NULL)
- error (EXIT_FAILURE, errno, "tsearch");
+ error (EXIT_FAILURE, errno, "eu_tsearch");
++nmnemonics;
}
infname, i386_lineno - 1, $5->name);
struct suffix search = { .name = $5->name };
- if (tfind (&search, &suffixes, compare_suf)
+ if (eu_tfind (&search, &suffixes, compare_suf)
== NULL)
{
struct suffix *ns = xmalloc (sizeof (*ns));
ns->name = $5->name;
ns->idx = ++nsuffixes;
- if (tsearch (ns, &suffixes, compare_suf)
+ if (eu_tsearch (ns, &suffixes, compare_suf)
== NULL)
- error (EXIT_FAILURE, errno, "tsearch");
+ error (EXIT_FAILURE, errno, "eu_tsearch");
}
}
struct known_bitfield search;
search.name = $1;
struct known_bitfield **res;
- res = tfind (&search, &bitfields, bitfield_compare);
+ res = eu_tfind (&search, &bitfields, bitfield_compare);
if (res == NULL)
{
error (0, 0, "%d: unknown bitfield '%s'",
struct known_bitfield search;
search.name = $1;
struct known_bitfield **res;
- res = tfind (&search, &bitfields, bitfield_compare);
+ res = eu_tfind (&search, &bitfields, bitfield_compare);
if (res == NULL)
{
error (0, 0, "%d: unknown bitfield '%s'",
struct known_bitfield search;
search.name = $1;
struct known_bitfield **res;
- res = tfind (&search, &bitfields, bitfield_compare);
+ res = eu_tfind (&search, &bitfields, bitfield_compare);
if (res == NULL)
{
if (strcmp ($1, "ax") == 0)
newp->bits = num;
newp->tmp = 0;
- if (tfind (newp, &bitfields, bitfield_compare) != NULL)
+ if (eu_tfind (newp, &bitfields, bitfield_compare) != NULL)
{
error (0, 0, "%d: duplicated definition of bitfield '%s'",
i386_lineno, name);
return;
}
- if (tsearch (newp, &bitfields, bitfield_compare) == NULL)
+ if (eu_tsearch (newp, &bitfields, bitfield_compare) == NULL)
error (EXIT_FAILURE, errno, "%d: cannot insert new bitfield '%s'",
i386_lineno, name);
}
struct synonym search = { .from = fieldname };
- struct synonym **res = tfind (&search, &synonyms, compare_syn);
+ struct synonym **res = eu_tfind (&search, &synonyms, compare_syn);
if (res != NULL)
fieldname = (*res)->to;
if (runp->operands[i].fct != NULL)
{
struct argstring search = { .str = runp->operands[i].fct };
- if (tfind (&search, &fct_names[i], compare_argstring) == NULL)
+ if (eu_tfind (&search, &fct_names[i], compare_argstring) == NULL)
{
struct argstring *newp = xmalloc (sizeof (*newp));
newp->str = runp->operands[i].fct;
newp->idx = 0;
- if (tsearch (newp, &fct_names[i], compare_argstring) == NULL)
- error (EXIT_FAILURE, errno, "tsearch");
+ if (eu_tsearch (newp, &fct_names[i], compare_argstring) == NULL)
+ error (EXIT_FAILURE, errno, "eu_tsearch");
++nfct_names[i];
}
if (runp->operands[i].str != NULL)
{
search.str = runp->operands[i].str;
- if (tfind (&search, &strs[i], compare_argstring) == NULL)
+ if (eu_tfind (&search, &strs[i], compare_argstring) == NULL)
{
struct argstring *newp = xmalloc (sizeof (*newp));
newp->str = runp->operands[i].str;
newp->idx = 0;
- if (tsearch (newp, &strs[i], compare_argstring) == NULL)
- error (EXIT_FAILURE, errno, "tsearch");
+ if (eu_tsearch (newp, &strs[i], compare_argstring) == NULL)
+ error (EXIT_FAILURE, errno, "eu_tsearch");
++nstrs[i];
}
}
if (instr->operands[i].fct != NULL)
{
struct argstring search = { .str = instr->operands[i].fct };
- struct argstring **res = tfind (&search, &fct_names[i],
+ struct argstring **res = eu_tfind (&search, &fct_names[i],
compare_argstring);
assert (res != NULL);
idx = (*res)->idx;
if (instr->operands[i].str != NULL)
{
struct argstring search = { .str = instr->operands[i].str };
- struct argstring **res = tfind (&search, &strs[i],
+ struct argstring **res = eu_tfind (&search, &strs[i],
compare_argstring);
assert (res != NULL);
idx = (*res)->idx;