[gtk-doc] mkdb: improve readability and use UpdateFileIfChanged



commit cb20f9213d1fdf7beb2c5627b76bb4f7e712fed7
Author: Stefan Kost <ensonic users sf net>
Date:   Fri Jan 1 23:51:45 2010 +0200

    mkdb: improve readability and use UpdateFileIfChanged
    
    Using UpdateFileIfChanged is nice if someone wants to depend on report file
    changes among other things.

 gtkdoc-mkdb.in |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in
index 625b752..d08b5b6 100755
--- a/gtkdoc-mkdb.in
+++ b/gtkdoc-mkdb.in
@@ -3940,6 +3940,9 @@ sub ScanSourceFile {
 #############################################################################
 
 sub OutputMissingDocumentation {
+    my $old_undocumented_file = "$ROOT_DIR/$MODULE-undocumented.txt";
+    my $new_undocumented_file = "$ROOT_DIR/$MODULE-undocumented.new";
+
     my $n_documented = 0;
     my $n_incomplete = 0;
     my $total = 0;
@@ -3950,8 +3953,8 @@ sub OutputMissingDocumentation {
     my $buffer_deprecated = "";
     my $buffer_descriptions = "";
     
-    open (UNDOCUMENTED, ">$ROOT_DIR/$MODULE-undocumented.txt")
-      || die "Can't create $ROOT_DIR/$MODULE-undocumented.txt: $!";
+    open(UNDOCUMENTED, ">$new_undocumented_file")
+      || die "Can't create $new_undocumented_file";
     
     foreach $symbol (sort (keys (%AllSymbols))) {
         # FIXME: should we print LogWarnings for undocumented stuff?
@@ -4018,10 +4021,13 @@ sub OutputMissingDocumentation {
     print UNDOCUMENTED ($total - $n_documented) . " not documented.\n\n\n";
     
     print UNDOCUMENTED $buffer;
-    
     close (UNDOCUMENTED);
     
-    printf (("%.0f%% symbol docs coverage ($n_documented symbols documented, $n_incomplete symbols incomplete, " . ($total - $n_documented) . " not documented)\nSee $MODULE-undocumented.txt for a list of missing docs.\nThe doc coverage percentage doesn't include intro sections.\n"), $percent);
+    return &UpdateFileIfChanged ($old_undocumented_file, $new_undocumented_file, 0);
+    
+    printf "%.0f%% symbol docs coverage", $percent;
+    print "($n_documented symbols documented, $n_incomplete symbols incomplete, " . ($total - $n_documented) . " not documented)\n";
+    print "See $MODULE-undocumented.txt for a list of missing docs.\nThe doc coverage percentage doesn't include intro sections.\n";
 }
 
 



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