[Libburn] some questions
mikael at phubuh.org
Fri Nov 19 06:03:42 PST 2004
Steven Van Impe <steven.vanimpe at telenet.be> writes:
> > > 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).
Nope. They're stored in the object file and accessible any time.
> Anyway, this seems to work fine (this is basically what happens in
> #include <stdio.h>
> void fill (char **ext)
> *ext = "foo";
> int main ()
> char *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 ?
It's perfectly sane. (Just make sure you don't try to modify the "foo"
string: string literals are often read-only and modifying them invokes
More information about the libburn