John Darrington <[EMAIL PROTECTED]> writes:
> A couple of concerns about any-writer.c :
>
> if (!strcmp (extension, ".por"))
>
> This is not a very reliable test. Can we not think of a better way of
> guessing a file's type.
We don't have to guess the file's type. We can set any rules we
like. We are creating the file, after all.
> If not, at least make this a case insensitive compare?
We could make it case insensitive.
> static struct any_writer *
> make_any_writer (enum any_writer_type type, void *private)
> {
> if (private != NULL)
> {
> struct any_writer *writer = xmalloc (sizeof *writer);
>
>
> This xmalloc is never getting freed.
Oops.
> I'm not sure of the ownership rules of a struct any_writer. Who is
> responsible for freeing it?
It should be freed in any_writer_close().
> The same goes for struct any_reader.
Ditto.
> any_{reader,writer} is an abstract type and any_{reader,writer}_open
> is the corresponing abstract factory? Shouldn't the factory therefore
> be responsible for cleaning up the object?
Yes, it's just a simple oversight.
I will check in these changes, which are quite simple.
--
Ben Pfaff
email: [EMAIL PROTECTED]
web: http://benpfaff.org
_______________________________________________
pspp-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/pspp-dev