help-gnats
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing libiberty (was Re: gnatsd problems with 4.0.1)


From: Mike M. Volokhov
Subject: Re: Removing libiberty (was Re: gnatsd problems with 4.0.1)
Date: Wed, 9 Feb 2005 12:11:02 +0200

On Mon, 7 Feb 2005 11:42:01 -0600
Chad Walstrom <address@hidden> wrote:

> Mike M. Volokhov wrote:
[snip]
> > So, only six functions are used by GNATS, when libiberty provides
> > about 40. Only two functions (asprintf and vasprintf) are nor POSIX
> > nor standard C relevant (but included in both GNU and BSD libc).
> 
> Actually, add one more: getopt(), which is the one that's currently
> giving us problems on the BSD platform.

What kind of troubles you have? Yes, there is a set of differences, but
I just wish to know a direction to handle them.

> > Three functions (xstrdup, xmalloc, xrealloc) are totally
> > libiberty-own, but can be easy replaced with their standard
> > equivalents.
> 
> Yes.  They're convenience functions documented in the glibc "standards"
> manual as well.  In fact, writing wrapper functions is well documented
> by the venerable Stevens in his Unix programming books, although I
> believe he would have named the wrapper "Malloc()".  ;-) As such,
> they're not bad little functions, but I agree that we shouldn't have to
> carry libiberty around just for these three.
> 
> > Thus, I propose to eliminate dependency on libiberty completely.
> 
> I support that proposal.  When only 7 of 42 are required, they should be
> relatively easy to move into misc.c or a utils.{c,h} file pair and
> support in autoconf.

Exactly. The utils.[ch] possible the best place for handling this small
piece of software. Altough, I have rewrite some functions from scratch
and thus it can be joined the misc.[ch] files.

Please take a look to my patch which eliminates "libiberty" and
"include" directories completely. To test it:

1) Please be sure you have yesterday's AnonCVS sources.
2) Save the attached compressed diff to gnats subdirectory.
3) Apply a patch saved:
        gunzip < gnats-wo-libiberty.diff.gz | patch
4) Rename or remove "libiberty" and "include" subdirectories.
5) Configure and install GNATS as usual.

The following files was changed:

        Makefile.in
        configure
        configure.in
        configure
        gnats/Makefile.in
        gnats/ansidecl.h (moved from include/ansidecl.h)
        gnats/configure
        gnats/configure.in
        gnats/gnats.h
        gnats/util.h (added)
        gnats/util.c (added)
        libiberty/* (all removed)
        include/* (all removed)

The following functions was rewritten from scratch and was based on
their respective standard equivalents:

        xmalloc()
        xrealloc()
        xstrdup()

The following functions should be shipped by 3rd-party vendors and thus
configure will rely on them (yes, I've dropped them from GNATS):

        basename()
        asprintf()
        vasprintf()

The xstrndup() function was changed to more fault-tolerant behaviour,
when passed length is less than 1. This fixes potential problems with
other functions which relies on xstrndup(), i.e.:

        strlen(xstrndup(string, 0))

I did some tests on my NetBSD 2.x and have not any visible troubles.

--
Mishka.

Attachment: gnats-wo-libiberty.diff.gz
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]