pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: any-writer.c


From: Ben Pfaff
Subject: Re: any-writer.c
Date: Fri, 24 Mar 2006 18:07:35 -0800
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> 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: address@hidden
web: http://benpfaff.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]