[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GPT name overflow
From: |
Andrew Clausen |
Subject: |
Re: GPT name overflow |
Date: |
Tue, 19 Mar 2002 19:51:13 +1100 |
User-agent: |
Mutt/1.3.17i |
On Mon, Mar 18, 2002 at 10:13:12PM -0700, Andreas Dilger wrote:
> Well, the problem is that I generally don't want to free code that is
> not allocated by my program (sometimes you are supposed to, sometimes
> you aren't). Even worse is if there is a mismatch between the malloc/free
> used by the library, and that in the application. Usually, if I ever
> write code which does this, I also supply a "foo_free" function, even if
> it is just a wrapper around "free()", to avoid problems.
>
> > > I'd rather we had to pass in an array (how to know size?)
> > > and copy the name string into that.
> >
> > I prefer the opposite, hehe. strdup() and free() are simple.
> > snprintf, 2 parameters, etc. is complicated.
>
> Well, I'm not saying this is great, but it is better than one piece of
> code allocating memory, and another piece of code freeing it.
Here's a philosophical justication:
free() is char*'s destructor
It always makes sense to free() a char* (as opposed to const char*),
unless something REALLY funky is happening...
Andrew
- Re: GPT name overflow, (continued)
- Re: GPT name overflow, Andreas Dilger, 2002/03/09
- Re: GPT name overflow, Andreas Dilger, 2002/03/09
- Re: GPT name overflow, Andrew Clausen, 2002/03/09
- Re: GPT name overflow, Andreas Dilger, 2002/03/10
- Re: GPT name overflow, Andrew Clausen, 2002/03/10
- Re: GPT name overflow, Richard Hirst, 2002/03/18
- Re: GPT name overflow, Andrew Clausen, 2002/03/19
- Re: GPT name overflow, Andreas Dilger, 2002/03/19
- Re: GPT name overflow, Andrew Clausen, 2002/03/19
- Re: GPT name overflow, Andreas Dilger, 2002/03/19
- Re: GPT name overflow,
Andrew Clausen <=