]> rtime.felk.cvut.cz Git - notmuch.git/commitdiff
cli/insert: rename check_folder_name to is_valid_folder_name
authorJani Nikula <jani@nikula.org>
Mon, 22 Sep 2014 09:54:53 +0000 (11:54 +0200)
committerDavid Bremner <david@tethera.net>
Wed, 24 Sep 2014 18:20:02 +0000 (20:20 +0200)
An "is something" predicate conveys the meaning better. While at it,
improve the function documentation and error message. Besides the
error message change, no functional changes.

notmuch-insert.c

index 8dfc8bb9c2bdb6592ec306deda9642237866aee2..770275bb1f98924aadbe6a12a7d213a663b88165 100644 (file)
@@ -83,10 +83,13 @@ sync_dir (const char *dir)
     return ret;
 }
 
-/* Check the specified folder name does not contain a directory
- * component ".." to prevent writes outside of the Maildir hierarchy. */
+/*
+ * Check the specified folder name does not contain a directory
+ * component ".." to prevent writes outside of the Maildir
+ * hierarchy. Return TRUE on valid folder name, FALSE otherwise.
+ */
 static notmuch_bool_t
-check_folder_name (const char *folder)
+is_valid_folder_name (const char *folder)
 {
     const char *p = folder;
 
@@ -449,8 +452,8 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
     if (folder == NULL) {
        maildir = db_path;
     } else {
-       if (! check_folder_name (folder)) {
-           fprintf (stderr, "Error: bad folder name: %s\n", folder);
+       if (! is_valid_folder_name (folder)) {
+           fprintf (stderr, "Error: invalid folder name: '%s'\n", folder);
            return EXIT_FAILURE;
        }
        maildir = talloc_asprintf (config, "%s/%s", db_path, folder);