summaryrefslogtreecommitdiff
path: root/src/bookmarks.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-11-27 08:34:00 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-11-27 08:34:00 +0200
commit596f876267e0c719329447ea49bc262eb9ebcc1a (patch)
tree4e86c88c1bcf3050e39b95b2e9d868e1a09f25ea /src/bookmarks.c
parente648ca3f621b1d612303218d97d395dada5503b2 (diff)
Bookmarks: Adding and removing tags
Diffstat (limited to 'src/bookmarks.c')
-rw-r--r--src/bookmarks.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/bookmarks.c b/src/bookmarks.c
index 0791a207..8bde5b8b 100644
--- a/src/bookmarks.c
+++ b/src/bookmarks.c
@@ -50,6 +50,19 @@ iBool hasTag_Bookmark(const iBookmark *d, const char *tag) {
50 return found; 50 return found;
51} 51}
52 52
53void addTag_Bookmark(iBookmark *d, const char *tag) {
54 if (!isEmpty_String(&d->tags)) {
55 appendChar_String(&d->tags, ' ');
56 }
57 appendCStr_String(&d->tags, tag);
58}
59
60void removeTag_Bookmark(iBookmark *d, const char *tag) {
61 const size_t pos = indexOfCStr_String(&d->tags, tag);
62 remove_Block(&d->tags.chars, pos, strlen(tag));
63 trim_String(&d->tags);
64}
65
53iDefineTypeConstruction(Bookmark) 66iDefineTypeConstruction(Bookmark)
54 67
55static int cmpTimeDescending_Bookmark_(const iBookmark **a, const iBookmark **b) { 68static int cmpTimeDescending_Bookmark_(const iBookmark **a, const iBookmark **b) {