[cig-commits] r15982 - doc/geodynamics.org/benchmarks/trunk

luis at geodynamics.org luis at geodynamics.org
Mon Nov 16 14:49:43 PST 2009


Author: luis
Date: 2009-11-16 14:49:42 -0800 (Mon, 16 Nov 2009)
New Revision: 15982

Modified:
   doc/geodynamics.org/benchmarks/trunk/watcher.c
Log:
Removed unused function, and clarified a few comments.

Luckily not much had to be modified in watcher.c
since we were already watching all the files listed
in sources.txt, and reloaded their .html form regardless
of the original extension (whether .rst or .html).

Modified: doc/geodynamics.org/benchmarks/trunk/watcher.c
===================================================================
--- doc/geodynamics.org/benchmarks/trunk/watcher.c	2009-11-16 22:49:36 UTC (rev 15981)
+++ doc/geodynamics.org/benchmarks/trunk/watcher.c	2009-11-16 22:49:42 UTC (rev 15982)
@@ -226,25 +226,8 @@
 
 // ----------------------------------------------------------------------------
 
-/* Given an .html filename, set the file extension to .rst
+/* Given a filename, change file extension to .html
  *
- * The filename is assumed to be long enough (consists of at least ".html").
- * Also, the string is modified in-place.
- */
-void set_rst_extension(char *filename)
-{
-    int len = strlen(filename);
-    assert(len > 5);
-    filename[len-1] = '\0';
-    filename[len-2] = '\0';
-    filename[len-3] = 't';
-    filename[len-4] = 's';
-    filename[len-5] = 'r';
-}
-
-
-/* Given an .rst filename, change file extension to .html
- *
  * The filename is assumed to be long enough to support
  * the longer .html extension.
  */
@@ -266,7 +249,7 @@
     static char loaded[1024];
     char html[1000];
 
-    /* get at path's own .html file */
+    /* convert path's extension to .html */
     strncpy(html, path, sizeof(html));
     set_html_extension(html);
 
@@ -343,7 +326,7 @@
     f = readfiles();
     if (f == NULL)
     {
-        fprintf(stderr, "Could not read list of files.");
+        fprintf(stderr, "Could not read list of files in 'sources.txt'");
         exit(-1);
     }
     
@@ -422,12 +405,16 @@
              * We do this because when vim saves a file, it replaces it
              * by the temporary copy it used for editing. This means our
              * original file descriptor is now stale, since the original
-             * file gets renamed and then deleted. However, the file was
-             * only replaced, so we can open it again using the same path.
+             * file gets renamed and then deleted. Therefore we must reopen
+             * the same path to obtain a new handle to the latest copy of
+             * our file.
+             *
+             * Of course, if we can't reopen the same path, then the file
+             * was deleted by someone else. In that case, we just quit.
              */
             if (fflags & NOTE_DELETE)
             {
-                /* save the old file descriptor */
+                /* save the old file descriptor, so we can close it later */
                 int fd_old = n->fd;
 
                 /* reopen with same path */



More information about the CIG-COMMITS mailing list