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

cookie: overhaul and cleanup #15247

Closed
wants to merge 4 commits into from
Closed

cookie: overhaul and cleanup #15247

wants to merge 4 commits into from

Conversation

bagder
Copy link
Member

@bagder bagder commented Oct 10, 2024

  • split the huge Curl_cookie_add() into several smaller static functions

  • switch to using the common llist instead of custom linked list

  • use less memory for *getlist()

  • use bitfields for flags in the Cookie struct

- split the huge Curl_cookie_add() into several smaller static functions

- switch to using the common llist instead of custom linked list

- use less memory for *getlist()

- use bitfields for flags in the Cookie struct
@bagder
Copy link
Member Author

bagder commented Oct 10, 2024

McCabe cyclomatic complexity on cookie.c

Top-10 with this PR applied

81      83      142     472     324     lib/cookie.c(473): parse_cookie_header
34      34      47      979     103     lib/cookie.c(980): replace_existing
27      33      75      797     133     lib/cookie.c(798): parse_netscape
23      23      44      1093    100     lib/cookie.c(1094): Curl_cookie_add
20      20      43      1348    98      lib/cookie.c(1348): Curl_cookie_getlist
16      16      58      1552    95      lib/cookie.c(1552): cookie_output
15      15      41      1209    75      lib/cookie.c(1209): Curl_cookie_init
14      14      26      1293    30      lib/cookie.c(1293): cookie_sort
11      11      34      143     70      lib/cookie.c(143): pathmatch
10      10      8       1518    25      lib/cookie.c(1518): get_netscape_format

Top-10 in master (without this PR)

175     183     350     483     712     lib/cookie.c(484): Curl_cookie_add
21      21      48      1378    110     lib/cookie.c(1378): Curl_cookie_getlist
16      16      57      1618    92      lib/cookie.c(1618): cookie_output
14      14      38      1211    73      lib/cookie.c(1211): Curl_cookie_init
14      14      26      1293    30      lib/cookie.c(1293): cookie_sort
11      11      34      156     70      lib/cookie.c(156): pathmatch
10      10      8       1584    25      lib/cookie.c(1584): get_netscape_format
10      10      23      381     48      lib/cookie.c(381): remove_expired
8       8       26      1711    32      lib/cookie.c(1711): cookie_list
8       8       24      1526    35      lib/cookie.c(1526): Curl_cookie_clearsess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant