]> git.notmuchmail.org Git - notmuch/commitdiff
Remove some variables which were set but not used.
authorCarl Worth <cworth@cworth.org>
Wed, 11 May 2011 19:34:13 +0000 (12:34 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 11 May 2011 20:27:14 +0000 (13:27 -0700)
gcc (at least as of version 4.6.0) is kind enough to point these out to us,
(when given -Wunused-but-set-variable explicitly or implicitly via -Wunused
or -Wall).

One of these cases was a legitimately unused variable. Two were simply
variables (named ignored) we were assigning only to squelch a warning about
unused function return values. I don't seem to be getting those warnings
even without setting the ignored variable. And the gcc docs. say that the
correct way to squelch that warning is with a cast to (void) anyway.

lib/message.cc
notmuch-new.c
notmuch-tag.c

index ecda75af208b416124fd9cc6bc165c56e5ed0521..a5a65e21701b49530ac755ab4be6e6e9d3acae72 100644 (file)
@@ -213,7 +213,6 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch,
 {
     notmuch_message_t *message;
     Xapian::Document doc;
-    Xapian::WritableDatabase *db;
     unsigned int doc_id;
     char *term;
 
@@ -233,7 +232,6 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch,
     if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY)
        INTERNAL_ERROR ("Failure to ensure database is writable.");
 
-    db = static_cast<Xapian::WritableDatabase *> (notmuch->xapian_db);
     try {
        doc.add_term (term, 0);
        talloc_free (term);
index 4874a1c1d09b5eb506f5eb642bb803669eb9acd3..744f4ca3396310f6c3ed41e814d654cd64f278f8 100644 (file)
@@ -64,10 +64,9 @@ static volatile sig_atomic_t interrupted;
 static void
 handle_sigint (unused (int sig))
 {
-    ssize_t ignored;
     static char msg[] = "Stopping...         \n";
 
-    ignored = write(2, msg, sizeof(msg)-1);
+    write(2, msg, sizeof(msg)-1);
     interrupted = 1;
 }
 
index 60e21e0deb8c89e02e29d3845233fa7687701668..6204ae3cefcaddb78051a8b5955ec642db596b08 100644 (file)
@@ -25,10 +25,8 @@ static volatile sig_atomic_t interrupted;
 static void
 handle_sigint (unused (int sig))
 {
-    ssize_t ignored;
-
     static char msg[] = "Stopping...         \n";
-    ignored = write(2, msg, sizeof(msg)-1);
+    write(2, msg, sizeof(msg)-1);
     interrupted = 1;
 }