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

wants to merge 2 commits into from

static function overhaul #3538

wants to merge 2 commits into from


Copy link

@bagder bagder 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 Compare February 9, 2019 22:30
Copy link
Member Author

bagder 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.

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
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 closed this in e81cd90 Feb 11, 2019
@bagder bagder deleted the bagder/static-singleuse branch February 11, 2019 07:56
@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.
None yet

Successfully merging this pull request may close these issues.

None yet

1 participant