AM_MAKEINFOFLAGS = --no-split -I "$(srcdir)/doc" -I doc
TEXI2DVI = texi2dvi -I "$(srcdir)/doc" -I doc
MKDOC = doc/chew$(EXEEXT_FOR_BUILD)
+LIBIBERTY = ../libiberty/libiberty.a
# We can't replace these rules with an implicit rule, because
# makes without VPATH support couldn't find the .h files in `..'.
$(AM_V_CCLD)$(CC_FOR_BUILD) -o doc/chw$$$$$(EXEEXT_FOR_BUILD) $(CFLAGS_FOR_BUILD) \
$(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \
-I. -I$(srcdir) -Idoc -I$(srcdir)/../include -I$(srcdir)/../intl -I../intl \
- $(srcdir)/doc/chew.c && \
+ $(srcdir)/doc/chew.c $(LIBIBERTY) && \
$(SHELL) $(srcdir)/../move-if-change \
doc/chw$$$$$(EXEEXT_FOR_BUILD) $(MKDOC) && \
touch $@
Foo. */
#include "ansidecl.h"
+#include "libiberty.h"
#include <assert.h>
#include <stdio.h>
#include <ctype.h>
{
buffer->write_idx = 0;
buffer->size = size;
- buffer->ptr = (char *) malloc (size);
+ buffer->ptr = xmalloc (size);
}
static void
if (buffer->write_idx == buffer->size)
{
buffer->size *= 2;
- buffer->ptr = (char *) realloc (buffer->ptr, buffer->size);
+ buffer->ptr = xrealloc (buffer->ptr, buffer->size);
}
buffer->ptr[buffer->write_idx++] = ch;
{
while (buffer->write_idx + len >= buffer->size)
buffer->size *= 2;
- buffer->ptr = (char *) realloc (buffer->ptr, buffer->size);
+ buffer->ptr = xrealloc (buffer->ptr, buffer->size);
}
memcpy (buffer->ptr + buffer->write_idx, buf, len);
buffer->write_idx += len;
}
}
- *word = (char *) malloc (length + 1);
+ *word = xmalloc (length + 1);
dst = *word;
src = word_start;
dict_type *
newentry (char *word)
{
- dict_type *new_d = (dict_type *) malloc (sizeof (dict_type));
+ dict_type *new_d = xmalloc (sizeof (*new_d));
new_d->word = word;
new_d->next = root;
root = new_d;
- new_d->code = (stinst_type *) malloc (sizeof (stinst_type));
+ new_d->code = xmalloc (sizeof (*new_d->code));
new_d->code_length = 1;
new_d->code_end = 0;
return new_d;
if (entry->code_end == entry->code_length)
{
entry->code_length += 2;
- entry->code =
- (stinst_type *) realloc ((char *) (entry->code),
- entry->code_length * sizeof (stinst_type));
+ entry->code = xrealloc (entry->code,
+ entry->code_length * sizeof (*entry->code));
}
entry->code[entry->code_end] = word;
void
add_intrinsic (char *name, void (*func) (void))
{
- dict_type *new_d = newentry (strdup (name));
+ dict_type *new_d = newentry (xstrdup (name));
add_to_definition (new_d, func);
add_to_definition (new_d, 0);
}
MKDOC = %D%/chew$(EXEEXT_FOR_BUILD)
+LIBIBERTY = ../libiberty/libiberty.a
+
$(MKDOC): %D%/chew.stamp ; @true
%D%/chew.stamp: $(srcdir)/%D%/chew.c %D%/$(am__dirstamp)
$(AM_V_CCLD)$(CC_FOR_BUILD) -o %D%/chw$$$$$(EXEEXT_FOR_BUILD) $(CFLAGS_FOR_BUILD) \
$(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \
-I. -I$(srcdir) -I%D% -I$(srcdir)/../include -I$(srcdir)/../intl -I../intl \
- $(srcdir)/%D%/chew.c && \
+ $(srcdir)/%D%/chew.c $(LIBIBERTY) && \
$(SHELL) $(srcdir)/../move-if-change \
%D%/chw$$$$$(EXEEXT_FOR_BUILD) $(MKDOC) && \
touch $@