From fe9b4a38888f82c0e4541cf31660d1e4329ac20d Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Wed, 8 Feb 2012 17:01:14 +0200 Subject: blob: optimize spn and cspn --- src/database.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/database.c') diff --git a/src/database.c b/src/database.c index d546d7e..e084b8b 100644 --- a/src/database.c +++ b/src/database.c @@ -33,6 +33,11 @@ #include "apk_archive.h" #include "apk_print.h" +static const apk_spn_match_def apk_spn_repo_separators = { + [4] = (1<<0) /* */, + [7] = (1<<2) /*:*/, +}; + enum { APK_DISALLOW_RMDIR = 0, APK_ALLOW_RMDIR = 1 @@ -1770,8 +1775,8 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t _repository) if (brepo.ptr[0] == '@') { apk_blob_pull_char(&brepo, '@'); - apk_blob_cspn(brepo, ": ", &btag, &brepo); - apk_blob_spn(brepo, ": ", NULL, &brepo); + apk_blob_cspn(brepo, apk_spn_repo_separators, &btag, &brepo); + apk_blob_spn(brepo, apk_spn_repo_separators, NULL, &brepo); tag_id = apk_db_get_tag_id(db, btag); } -- cgit v1.2.3-70-g09d2