[Libburn] some questions

Steven Van Impe steven.vanimpe at telenet.be
Fri Nov 19 01:54:45 PST 2004


> > 1) Why the pointer pointers for 'me' ? Why are these better than (or
> > needed instead of) just regular pointers to a struct iso_tree_file or
> > struct iso_tree_dir ?
> 
> Yeah, I'd like that explained too.
> 
> At a _really_ brief glance, I can't tell why the "me" field is required in 
> those structs at all.

Who wrote libisofs as it is today ? Is (s)he still reading this list ?

> > 2) About *ext = ""; in iso_split_filename (util.c): won't this leave
> > *ext pointing to something that will be destroyed when
> > iso_split_filename ends ?
> 
> Technically, I think string literals are in the text segment, but I'll 
> defer to a language lawyer on that one.

What's "the text segment" ?

I always thought literals were only kept for the scope of the expression
they're used in (since most of the time, you either _copy_ their value
into a variable or use them to calculate some value that is then
_copied_ into a variable).

Anyway, this seems to work fine (this is basically what happens in
tree.c/util.c):

#include <stdio.h>

void fill (char **ext)
{
	*ext = "foo";
}

int main ()
{
	char *ext;
	fill(&ext);
	printf("%s\n", ext);
	return 0;
}

Though I don't think this construction is sane (the memory held by "foo"
will probably be freed after the assignment and might be overwritten).
When declaring stuff as a pointer, shouldn't we use malloc/free ?

> Could just point *ext at the NULL on *name, I guess.

I think that's best (avoids malloc as well).

> > Note: I'm still using the 0.2 tarball, since cvs doesn't seem to work
> > right now (connection refused after the password request).
> 
> That's odd.  The ssh key has changed too.
> 
> Can't say I like that too much.

Seems fixed now.



More information about the libburn mailing list