BFS: Use the shared QueryParser.

Ideally should have no functional changes from the old one.

Change-Id: Id557d8fb069603221887447597ef0ffce5de07a6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7705
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Axel Dörfler <[email protected]>
This commit is contained in:
Augustin Cavalier
2024-06-24 19:40:08 +00:00
committed by waddlesplash
parent 7da55c7296
commit 0a44afc6bf
6 changed files with 295 additions and 1424 deletions
@@ -2268,26 +2268,10 @@ bfs_open_query(fs_volume* _volume, const char* queryString, uint32 flags,
Volume* volume = (Volume*)_volume->private_volume;
Expression* expression = new(std::nothrow) Expression((char*)queryString);
if (expression == NULL)
RETURN_ERROR(B_NO_MEMORY);
if (expression->InitCheck() < B_OK) {
INFORM(("Could not parse query \"%s\", stopped at: \"%s\"\n",
queryString, expression->Position()));
delete expression;
RETURN_ERROR(B_BAD_VALUE);
}
Query* query = new(std::nothrow) Query(volume, expression, flags);
if (query == NULL) {
delete expression;
RETURN_ERROR(B_NO_MEMORY);
}
if (flags & B_LIVE_QUERY)
query->SetLiveMode(port, token);
Query* query;
status_t error = Query::Create(volume, queryString, flags, port, token, query);
if (error != B_OK)
return error;
*_cookie = (void*)query;
@@ -2309,9 +2293,7 @@ bfs_free_query_cookie(fs_volume* _volume, void* cookie)
FUNCTION();
Query* query = (Query*)cookie;
Expression* expression = query->GetExpression();
delete query;
delete expression;
return B_OK;
}