diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-10-26 22:26:09 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-10-26 22:26:09 +0000 |
commit | 4c4162597814cdbbdd5748024671c03615b203d3 (patch) | |
tree | 6e241ad797a6a1e8733d8f348de223d05fdf3413 /src/fs/fs_uri.c | |
parent | 695f7138383c64e438fc2a98ea0e730f8332c953 (diff) | |
download | gnunet-4c4162597814cdbbdd5748024671c03615b203d3.tar.gz gnunet-4c4162597814cdbbdd5748024671c03615b203d3.zip |
api to remove keyword
Diffstat (limited to 'src/fs/fs_uri.c')
-rw-r--r-- | src/fs/fs_uri.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index 781871824..dff4b8686 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c | |||
@@ -799,6 +799,37 @@ GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri, | |||
799 | 799 | ||
800 | 800 | ||
801 | /** | 801 | /** |
802 | * Remove the given keyword from the set of keywords represented by the URI. | ||
803 | * Does nothing if the keyword is not present. | ||
804 | * | ||
805 | * @param uri ksk uri to modify | ||
806 | * @param keyword keyword to add | ||
807 | */ | ||
808 | void | ||
809 | GNUNET_FS_uri_ksk_remove_keyword (struct GNUNET_FS_Uri *uri, | ||
810 | const char *keyword) | ||
811 | { | ||
812 | unsigned int i; | ||
813 | char *old; | ||
814 | |||
815 | GNUNET_assert (uri->type == ksk); | ||
816 | for (i = 0; i < uri->data.ksk.keywordCount; i++) | ||
817 | { | ||
818 | old = uri->data.ksk.keywords[i]; | ||
819 | if (0 == strcmp (&old[1], keyword)) | ||
820 | { | ||
821 | uri->data.ksk.keywords[i] = uri->data.ksk.keywords[uri->data.ksk.keywordCount-1]; | ||
822 | GNUNET_array_grow (uri->data.ksk.keywords, | ||
823 | uri->data.ksk.keywordCount, | ||
824 | uri->data.ksk.keywordCount - 1); | ||
825 | GNUNET_free (old); | ||
826 | return; | ||
827 | } | ||
828 | } | ||
829 | } | ||
830 | |||
831 | |||
832 | /** | ||
802 | * Obtain the identity of the peer offering the data | 833 | * Obtain the identity of the peer offering the data |
803 | * | 834 | * |
804 | * @param uri the location URI to inspect | 835 | * @param uri the location URI to inspect |