talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit a3d780fa48454a12d79202d0272b28b05d8cc3b9
parent 1d999eaa69fb7ab2b92689167b548413a95a5ba9
Author: Colin Leroy <colin@colino.net>
Date:   Wed, 16 May 2012 08:00:56 +0000

2012-05-16 [colin]	3.8.0cvs44

	* src/common/utils.c
		Make remove_numbered_files much faster when there's
		just one file to remove.

Diffstat:
MChangeLog | 6++++++
MPATCHSETS | 1+
Mconfigure.ac | 2+-
Msrc/common/utils.c | 11+++++++++++
4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,9 @@ +2012-05-16 [colin] 3.8.0cvs44 + + * src/common/utils.c + Make remove_numbered_files much faster when there's + just one file to remove. + 2012-05-16 [paul] 3.8.0cvs43 * src/matcher.c diff --git a/PATCHSETS b/PATCHSETS @@ -4360,3 +4360,4 @@ ( cvs diff -u -r 1.4.2.40 -r 1.4.2.41 src/common/ssl_certificate.c; ) > 3.8.0cvs41.patchset ( cvs diff -u -r 1.5.2.32 -r 1.5.2.33 src/gtk/description_window.c; ) > 3.8.0cvs42.patchset ( cvs diff -u -r 1.75.2.69 -r 1.75.2.70 src/matcher.c; ) > 3.8.0cvs43.patchset +( cvs diff -u -r 1.36.2.196 -r 1.36.2.197 src/common/utils.c; ) > 3.8.0cvs44.patchset diff --git a/configure.ac b/configure.ac @@ -12,7 +12,7 @@ MINOR_VERSION=8 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=43 +EXTRA_VERSION=44 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/common/utils.c b/src/common/utils.c @@ -2322,6 +2322,17 @@ gint remove_numbered_files(const gchar *dir, guint first, guint last) gchar *prev_dir; gint file_no; + if (first == last) { + /* Skip all the dir reading part. */ + gchar *filename = g_strdup_printf("%s%s%u", dir, G_DIR_SEPARATOR_S, first); + if (claws_unlink(filename) < 0) { + FILE_OP_ERROR(filename, "unlink"); + g_free(filename); + return -1; + } + return 0; + } + prev_dir = g_get_current_dir(); if (g_chdir(dir) < 0) {