[vlc-devel] [PATCH v2 4/13] esout: refactor GetTmpFile()

Rémi Denis-Courmont remi at remlab.net
Wed Oct 7 19:55:25 CEST 2020


Le keskiviikkona 7. lokakuuta 2020, 4.14.01 EEST Lyndon Brown a écrit :
> On Tue, 2020-10-06 at 23:40 +0300, Rémi Denis-Courmont wrote:
> > Le tiistaina 6. lokakuuta 2020, 23.31.36 EEST Rémi Denis-Courmont a
> > 
> > écrit :
> > > How about *actually* factoring the admittedly repetitive code?
> > > 
> > > You can just call GetTempFile(filename, "/tmp"); and divide the
> > > length of
> > > the function in half. This does not need any external change.
> > 
> > And in fact, we really don't need a file name here at all, because we
> > really
> > don't need two concurrent file handles to the same file.
> > 
> > Could just as well use tmpfile() which would be safe from leaking
> > disk space.
> 
> I did make a little effort to trace the call stack of the function to
> better understand its use when I made the change, but did not go all
> the way with it.

It's just opening one FILE pointer for writing and another one for (seeking 
and) reading. The whole point of temporary files is to open them read/write and 
seek.

> If this is so, and no doubt you're right, then we should then consider
> dropping patch #9 since this function is the only user of the extra
> helper param that introduces.

Yes.

Are you planning to do it though?

-- 
Rémi Denis-Courmont
http://www.remlab.net/





More information about the vlc-devel mailing list