mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 02:24:46 +08:00
Re: use libiberty xmalloc in bfd/doc/chew.c
We can't use libiberty.a in chew. libiberty is a host library, chew
a build program. Partly revert commit 7273d78f3f
, instead define
local versions of the libiberty functions. ansidecl.h also isn't
needed.
* doc/chew.c: Don't include libiberty.h or ansidecl.h.
(xmalloc, xrealloc, xstrdup): New functions.
* doc/local.mk (LIBIBERTY): Don't define or use.
* Makefile.in: Regenerate.
This commit is contained in:
parent
739f950664
commit
b0de9ed86f
@ -1301,7 +1301,6 @@ doc_bfd_TEXINFOS = $(DOCFILES) doc/bfdsumm.texi
|
|||||||
AM_MAKEINFOFLAGS = --no-split -I "$(srcdir)/doc" -I doc
|
AM_MAKEINFOFLAGS = --no-split -I "$(srcdir)/doc" -I doc
|
||||||
TEXI2DVI = texi2dvi -I "$(srcdir)/doc" -I doc
|
TEXI2DVI = texi2dvi -I "$(srcdir)/doc" -I doc
|
||||||
MKDOC = doc/chew$(EXEEXT_FOR_BUILD)
|
MKDOC = doc/chew$(EXEEXT_FOR_BUILD)
|
||||||
LIBIBERTY = ../libiberty/libiberty.a
|
|
||||||
|
|
||||||
# We can't replace these rules with an implicit rule, because
|
# We can't replace these rules with an implicit rule, because
|
||||||
# makes without VPATH support couldn't find the .h files in `..'.
|
# makes without VPATH support couldn't find the .h files in `..'.
|
||||||
@ -2488,7 +2487,7 @@ doc/chew.stamp: $(srcdir)/doc/chew.c doc/$(am__dirstamp)
|
|||||||
$(AM_V_CCLD)$(CC_FOR_BUILD) -o doc/chw$$$$$(EXEEXT_FOR_BUILD) $(CFLAGS_FOR_BUILD) \
|
$(AM_V_CCLD)$(CC_FOR_BUILD) -o doc/chw$$$$$(EXEEXT_FOR_BUILD) $(CFLAGS_FOR_BUILD) \
|
||||||
$(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \
|
$(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \
|
||||||
-I. -I$(srcdir) -Idoc -I$(srcdir)/../include -I$(srcdir)/../intl -I../intl \
|
-I. -I$(srcdir) -Idoc -I$(srcdir)/../include -I$(srcdir)/../intl -I../intl \
|
||||||
$(srcdir)/doc/chew.c $(LIBIBERTY) && \
|
$(srcdir)/doc/chew.c && \
|
||||||
$(SHELL) $(srcdir)/../move-if-change \
|
$(SHELL) $(srcdir)/../move-if-change \
|
||||||
doc/chw$$$$$(EXEEXT_FOR_BUILD) $(MKDOC) && \
|
doc/chw$$$$$(EXEEXT_FOR_BUILD) $(MKDOC) && \
|
||||||
touch $@
|
touch $@
|
||||||
|
@ -81,8 +81,6 @@
|
|||||||
|
|
||||||
Foo. */
|
Foo. */
|
||||||
|
|
||||||
#include "ansidecl.h"
|
|
||||||
#include "libiberty.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -145,6 +143,45 @@ die (char *msg)
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
xmalloc (size_t size)
|
||||||
|
{
|
||||||
|
void *newmem;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
size = 1;
|
||||||
|
newmem = malloc (size);
|
||||||
|
if (!newmem)
|
||||||
|
die ("out of memory");
|
||||||
|
|
||||||
|
return newmem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
xrealloc (void *oldmem, size_t size)
|
||||||
|
{
|
||||||
|
void *newmem;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
size = 1;
|
||||||
|
if (!oldmem)
|
||||||
|
newmem = malloc (size);
|
||||||
|
else
|
||||||
|
newmem = realloc (oldmem, size);
|
||||||
|
if (!newmem)
|
||||||
|
die ("out of memory");
|
||||||
|
|
||||||
|
return newmem;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
xstrdup (const char *s)
|
||||||
|
{
|
||||||
|
size_t len = strlen (s) + 1;
|
||||||
|
char *ret = xmalloc (len);
|
||||||
|
return memcpy (ret, s, len);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_string_with_size (string_type *buffer, unsigned int size)
|
init_string_with_size (string_type *buffer, unsigned int size)
|
||||||
{
|
{
|
||||||
|
@ -82,14 +82,12 @@ TEXI2DVI = texi2dvi -I "$(srcdir)/%D%" -I %D%
|
|||||||
|
|
||||||
MKDOC = %D%/chew$(EXEEXT_FOR_BUILD)
|
MKDOC = %D%/chew$(EXEEXT_FOR_BUILD)
|
||||||
|
|
||||||
LIBIBERTY = ../libiberty/libiberty.a
|
|
||||||
|
|
||||||
$(MKDOC): %D%/chew.stamp ; @true
|
$(MKDOC): %D%/chew.stamp ; @true
|
||||||
%D%/chew.stamp: $(srcdir)/%D%/chew.c %D%/$(am__dirstamp)
|
%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) \
|
$(AM_V_CCLD)$(CC_FOR_BUILD) -o %D%/chw$$$$$(EXEEXT_FOR_BUILD) $(CFLAGS_FOR_BUILD) \
|
||||||
$(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \
|
$(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \
|
||||||
-I. -I$(srcdir) -I%D% -I$(srcdir)/../include -I$(srcdir)/../intl -I../intl \
|
-I. -I$(srcdir) -I%D% -I$(srcdir)/../include -I$(srcdir)/../intl -I../intl \
|
||||||
$(srcdir)/%D%/chew.c $(LIBIBERTY) && \
|
$(srcdir)/%D%/chew.c && \
|
||||||
$(SHELL) $(srcdir)/../move-if-change \
|
$(SHELL) $(srcdir)/../move-if-change \
|
||||||
%D%/chw$$$$$(EXEEXT_FOR_BUILD) $(MKDOC) && \
|
%D%/chw$$$$$(EXEEXT_FOR_BUILD) $(MKDOC) && \
|
||||||
touch $@
|
touch $@
|
||||||
|
Loading…
Reference in New Issue
Block a user