From: Michal Rokos Date: 2002-08-28T18:14:54+09:00 Subject: Re: [Cleanup?] File (struct stat handling) Hello, On Wed, Aug 28, 2002 at 08:06:10AM +0900, Yukihiro Matsumoto wrote: > > Could you explain why you prefer memcpy? I'm just curious. > The patch itself is OK. > Shame on me... I don't prefer memcpy - I'm just dumb and poor 'C'-programmer... :-(( Michal PS: I'm going to commit this patch... Index: file.c =================================================================== RCS file: /src/ruby/file.c,v retrieving revision 1.107 diff -u -p -r1.107 file.c --- file.c 2002/08/28 08:05:23 1.107 +++ file.c 2002/08/28 09:11:59 @@ -2009,6 +2009,10 @@ rb_stat_init(obj, fname) if (stat(RSTRING(fname)->ptr, &st) == -1) { rb_sys_fail(RSTRING(fname)->ptr); } + if (DATA_PTR(obj)) { + free(DATA_PTR(obj)); + DATA_PTR(obj) = NULL; + } nst = ALLOC(struct stat); *nst = st; DATA_PTR(obj) = nst; -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Michal Rokos Czech Technical University, Prague E-mail:m.rokos@sh.cvut.cz ICQ:36118339 Jabber:majkl@jabber.cz -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-