user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 0/7] dead code elimination
@ 2019-10-21 11:22  7% Eric Wong
  2019-10-21 11:22  6% ` [PATCH 4/7] watchmaildir: remove redundant _path_to_mime Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-10-21 11:22 UTC (permalink / raw)
  To: meta

I noticed OverIdx->delete_articles was unused while
working on the --reindex bug with multiple Message-IDs,
and went looking for more dead code.

This should make release tarballs smaller, at least.

Eric Wong (7):
  overidx: remove unused delete_articles sub
  www: remove unused ctx_get sub
  inboxwritable: import_maildir uses maildir_path_load
  watchmaildir: remove redundant _path_to_mime
  git: remove src_blob_url
  hval: remove new_oneline
  syscall: get rid of sendfile wrappers for now

 lib/PublicInbox/Git.pm           | 11 -----
 lib/PublicInbox/Hval.pm          |  8 ----
 lib/PublicInbox/InboxWritable.pm |  2 +-
 lib/PublicInbox/OverIdx.pm       |  6 ---
 lib/PublicInbox/Syscall.pm       | 75 +-------------------------------
 lib/PublicInbox/WWW.pm           |  7 ---
 lib/PublicInbox/WatchMaildir.pm  | 20 ++-------
 7 files changed, 5 insertions(+), 124 deletions(-)

^ permalink raw reply	[relevance 7%]

* [PATCH 4/7] watchmaildir: remove redundant _path_to_mime
  2019-10-21 11:22  7% [PATCH 0/7] dead code elimination Eric Wong
@ 2019-10-21 11:22  6% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-10-21 11:22 UTC (permalink / raw)
  To: meta

InboxWritable::maildir_path_load exists and we may support
it for use with standalone scripts.
---
 lib/PublicInbox/WatchMaildir.pm | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index 08b1aab4..e9231780 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -13,6 +13,7 @@ use File::Temp qw//;
 use PublicInbox::Filter::Base;
 use PublicInbox::Spamcheck;
 *REJECT = *PublicInbox::Filter::Base::REJECT;
+*maildir_path_load = *PublicInbox::InboxWritable::maildir_path_load;
 
 sub new {
 	my ($class, $config) = @_;
@@ -124,7 +125,7 @@ sub _remove_spam {
 	my ($self, $path) = @_;
 	# path must be marked as (S)een
 	$path =~ /:2,[A-R]*S[T-Za-z]*\z/ or return;
-	my $mime = _path_to_mime($path) or return;
+	my $mime = maildir_path_load($path) or return;
 	$self->{config}->each_inbox(sub {
 		my ($ibx) = @_;
 		eval {
@@ -166,7 +167,7 @@ sub _try_path {
 		$warn_cb->(@_);
 	};
 	foreach my $ibx (@$inboxes) {
-		my $mime = _path_to_mime($path) or next;
+		my $mime = maildir_path_load($path) or next;
 		my $im = _importer_for($self, $ibx);
 
 		# any header match means it's eligible for the inbox:
@@ -259,21 +260,6 @@ sub scan {
 	trigger_scan($self, 'cont') if keys %$opendirs;
 }
 
-sub _path_to_mime {
-	my ($path) = @_;
-	if (open my $fh, '<', $path) {
-		local $/;
-		my $str = <$fh>;
-		$str or return;
-		return PublicInbox::MIME->new(\$str);
-	} elsif ($!{ENOENT}) {
-		return;
-	} else {
-		warn "failed to open $path: $!\n";
-		return;
-	}
-}
-
 sub _importer_for {
 	my ($self, $ibx) = @_;
 	my $importers = $self->{importers};

^ permalink raw reply related	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-10-21 11:22  7% [PATCH 0/7] dead code elimination Eric Wong
2019-10-21 11:22  6% ` [PATCH 4/7] watchmaildir: remove redundant _path_to_mime Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).