Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add url_search_params_reset api #701

Merged
merged 1 commit into from
Jul 6, 2024
Merged

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Jul 6, 2024

Adds a new API to reuse the existing std::vector.

Usage:

TEST(ada_c, ada_search_params_reset) {
  ada_url_search_params out;

  std::string_view input = "a=b&c=d&c=e&f=g";
  out = ada_parse_search_params(input.data(), input.size());
  ASSERT_EQ(ada_search_params_size(out), 4);

  std::string_view resetted_value = "a=b";
  ada_search_params_reset(out, resetted_value.data(), resetted_value.size());
  ASSERT_EQ(ada_search_params_size(out), 1);

  ada_free_search_params(out);
  SUCCEED();
}

Fixes #699

@anonrig anonrig requested review from lemire, jasnell and CarlosEduR July 6, 2024 17:37
@anonrig anonrig force-pushed the add-url-search-params-reset branch from f9c3765 to 41a4159 Compare July 6, 2024 17:39
@anonrig anonrig force-pushed the add-url-search-params-reset branch from 41a4159 to 4a3df67 Compare July 6, 2024 17:42
@anonrig anonrig merged commit eaf5361 into main Jul 6, 2024
36 checks passed
@anonrig anonrig deleted the add-url-search-params-reset branch July 6, 2024 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search parameters reset functionality
2 participants