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

static function overhaul #3538

Closed
wants to merge 2 commits into from

Conversation

@bagder
Copy link
Member

commented Feb 8, 2019

Here's a script to

  1. detect global functions within the library that are not used outside the single function where it is defined and
  2. detect functions using the curl_ - prefix without being part of the public API

... and the associated changes to a bunch of files to cleanup all issues the script detected. I'll subsequently have a go and see if I can add the script to one or more of the travis builds to make sure we detect these mistakes/optimizations before they land.

(I intend so squash all these into a single commit for the changes and one for the script before merging)

@bagder bagder force-pushed the bagder/static-singleuse branch 4 times, most recently from 624fce4 to 6c8ee6f Feb 8, 2019

@bagder

This comment has been minimized.

Copy link
Member Author

commented Feb 10, 2019

Running the script automatically in travis is probably far too troublesome due to all the various special builds we have. I'll just add the script for manual use.

bagder added 2 commits Feb 8, 2019
cleanup: make local functions static
urlapi: turn three local-only functions into statics

conncache: make conncache_find_first_connection static

multi: make detach_connnection static

connect: make getaddressinfo static

curl_ntlm_core: make hmac_md5 static

http2: make two functions static

http: make http_setup_conn static

connect: make tcpnodelay static

tests: make UNITTEST a thing to mark functions with, so they can be static for
normal builds and non-static for unit test builds

... and mark Curl_shuffle_addr accordingly.

url: make up_free static

setopt: make vsetopt static

curl_endian: make write32_le static

rtsp: make rtsp_connisdead static

warnless: remove unused functions

memdebug: remove one unused function, made another static
scripts/singleuse: script to use to track single-use functions
That is functions that are declared global but are not used from outside
of the file in which it is declared. Such functions should be made
static or even at times be removed.

It also verifies that all used curl_ prefixed functions are "blessed"

@bagder bagder force-pushed the bagder/static-singleuse branch from 6c8ee6f to aad9227 Feb 10, 2019

@bagder bagder closed this in e81cd90 Feb 11, 2019

@bagder bagder deleted the bagder/static-singleuse branch Feb 11, 2019

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
1 participant
You can’t perform that action at this time.