Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Minor DB write improvements
Browse files Browse the repository at this point in the history
 - Accept Collection instead of List where possible
 - Use ListUtils.single
  • Loading branch information
brendanlong committed Nov 24, 2018
1 parent c83ee89 commit ecef8bb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/DataBaseWriteAccess.vala
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public class FeedReader.DataBase : DataBaseReadOnly {
}
}

public void write_feeds(Gee.List<Feed> feeds)
public void write_feeds(Gee.Collection<Feed> feeds)
{
m_db.simple_query("BEGIN TRANSACTION");

Expand Down Expand Up @@ -180,7 +180,7 @@ public class FeedReader.DataBase : DataBaseReadOnly {
write_tags(list);
}

public void write_tags(Gee.List<Tag> tags)
public void write_tags(Gee.Collection<Tag> tags)
{
m_db.simple_query("BEGIN TRANSACTION");

Expand Down Expand Up @@ -214,9 +214,7 @@ public class FeedReader.DataBase : DataBaseReadOnly {

public void update_tag(Tag tag)
{
var list = new Gee.ArrayList<Tag>();
list.add(tag);
update_tags(list);
update_tags(ListUtils.single(tag));

if(FeedServer.get_default().tagIDaffectedByNameChange())
{
Expand Down Expand Up @@ -359,9 +357,7 @@ public class FeedReader.DataBase : DataBaseReadOnly {

public void update_article(Article article)
{
var list = new Gee.ArrayList<Article>();
list.add(article);
update_articles(list);
update_articles(ListUtils.single(article));
}

public void update_articles(Gee.List<Article> articles)
Expand Down

0 comments on commit ecef8bb

Please sign in to comment.