Hi Bill,<br><br>Below are some comments regarding your patch:<br><br>+ <br>+ return(ret);<br>+}<br><br>Don't use parentesis around the return value, it makes things harder to read.<br><br>+ int remain, n;<br>+ int buf_size = st_src->st_blksize;
<br>+ char *buf = (char *) alloca (buf_size);<br>+<br><br>It's better to avoid alloca for quite a few reasons and on this case, it's better to limit the maximum size of buf_size since it's value is outside mono's control.
<br><br>-<br>- g_free (utf8_src);<br>- g_free (utf8_dest);<br>- close (src_fd);<br>- close (dest_fd);<br>-<br>+ <br>+ g_free (utf8_replacedFileName);<br>+ g_free (utf8_replacementFileName);<br>+ g_free (utf8_backupFileName);
<br>+ close (backup_fd);<br>+ <br><br>Notice here that you're introducing some redudant whitespaces in the empty lines, this should be avoided as it make patches hard to read due to increased noise.<br><br>Besides that, I have a question. Wouldn't be possible to use sendfile for unix systems? Senfile skip copying data to user space and should be a lot faster than using read/write.
<br><br>Cheers!<br>Rodrigo<br><br><br><div><span class="gmail_quote">On 8/15/07, <b class="gmail_sendername">Bill Holmes</b> <<a href="mailto:email@example.com">firstname.lastname@example.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Attached is a patch that implements the 2.0 method File.IO.File.Replace.<br><br><a href="http://msdn2.microsoft.com/en-us/library/9etk7xw2.aspx">http://msdn2.microsoft.com/en-us/library/9etk7xw2.aspx</a><br><br>Some implementation details are as follows.
<br>-An internal call was added to perform this operation<br>-Most argument validation is performed in managed code.<br>-On windows we call ReplaceFile defined in Kernel32<br>-On !windows Replace file was implemented in io-layer/io.c
<br><br>*file-io.c: Added ves_icall_System_IO_MonoIO_ReplaceFile to call<br>ReplaceFile Kernel32 on windows or in io-layer.<br>*file-io.h: Added deceleration for ves_icall_System_IO_MonoIO_ReplaceFile<br>*icall-def.h: Register ves_icall_System_IO_MonoIO_ReplaceFile as an
<br>internal call.<br>*io.c: Added implementation for ReplaceFile.<br>*io.h: Added deceleration for ReplaceFile method.<br>*File.cs: Add implementation for IO.File.Replace methods.<br>*MonoIO.cs: Declared an internal call for ReplaceFile
<br>*FileTest.cs: Added a test for IO.File.Replace.<br><br>This may be less of a patch request and more of a "Tell me what I did<br>wrong." ;)<br><br>-bill<br><br>_______________________________________________
<br>Mono-devel-list mailing list<br><a href="mailto:Monoemail@example.com">Monofirstname.lastname@example.org</a><br><a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list">http://lists.ximian.com/mailman/listinfo/mono-devel-list