Re: More psiconv woes


Subject: Re: More psiconv woes
From: Thomas Fletcher (thomasf@qnx.com)
Date: Mon Jan 22 2001 - 07:23:09 CST


On Sun, 21 Jan 2001, Hubert Figuiere wrote:

[On the merits of strdup'ing or not]

> He can probably borrow the implementation we have in AbiWord :-)
> But this scares me as this would duplicate code. Perhaps finding a
> way to combine both, ie use its own strdup if none is available, but
> use UT_strdup if we compile psiconv within AbiWord :-))

I think that you are scared for no practical reason. strdup can
even be turned into a macro composed of other standard function
calls (all of which live in the C library generally).

char * my_strdup(const char *in) {
        return strcpy(malloc(strlen(in)+1), in);
}

doesn't really add an excessive amount of bloat ... granted
it doesn't behave nice in error conditions, but you can fix
that to make it more efficient and nicer to play with in just
a couple of extra lines.

Thomas
-------------------------------------------------------------
Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Neutrino Development Group
(613)-591-0931 http://www.qnx.com/~thomasf



This archive was generated by hypermail 2b25 : Mon Jan 22 2001 - 07:23:32 CST