8000 move curlx_ functions into lib/curlx/ by bagder · Pull Request #17253 · curl/curl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

move curlx_ functions into lib/curlx/ #17253

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

Merged
merged 1 commit into from
May 7, 2025
Merged

move curlx_ functions into lib/curlx/ #17253

merged 1 commit into from
May 7, 2025

Conversation

bagder
Copy link
Member
@bagder bagder commented May 6, 2025

As discussed on curl up 2025.

And use the prefix consistently.

The printf defines are now done for the library alone. Tests no longer use the printf defines. The tool code sets its own defines. The printf functions are not curlx, they are publicly available.

The strcase defines are not curlx_ functions and should not be used by tool or server code.

When libcurl is built statically, the functions from the library can be used as-is. The key is then that the functions must work as-is, without having to be recompiled for use in tool/tests. This avoids symbol collisions - when libcurl is built statically, we use those functions directly when building the tool/tests. When libcurl is shared, we build/link them separately for the tool/tests.

  • dynbuf
  • warnless
  • base64
  • strcase (removed from curlx)
  • timeval
  • timediff
  • strparse
  • curlx_get_line (removed from curlx)

Saved for later

  • curlx_inet_pton
  • curlx_win32_open
  • curlx_winapi_strerror
  • curlx_convert_UTF8_to_tchar
  • curlx_nonblock
  • safefree

@testclutch

This comment was marked as outdated.

bagder added a commit th 8000 at referenced this pull request May 6, 2025
The first step to move all curlx_ function into its own subdir.

The idea is to use the curlx_ prefix proper on these functions, and use these
same function names both in tool, lib and test suite source code. Stop the
previous special #define setup for curlx_ names.

The printf defines are now done for the library alone. Tests no longer
use the printf defines. The tool code sets its own defines. The printf
functions are not curlx, they are publicly available.

The strcase defines are not curlx_ functions and should not be used by
tool or server code.

dynbuf, warnless, base64 are now proper curlx.

Closes #17253
@bagder bagder marked this pull request as ready for review May 6, 2025 22:02
@bagder
Copy link
Member Author
bagder commented May 6, 2025

Only the legacy MSVC generator batch script fails now and how on earth does it work? @vszakats @jay any clues on what the problem might be?

Makes me eager to just... drop it.

@jay
Copy link
Member
jay commented May 6, 2025

I will try it but just from looking at the changes I think one thing that could be an issue is the include needs the same transformation as vtls because the directory isn't included. Like there's #include "vtls/vtls.h" since vtls.h is in its own directory, so maybe #include <curlx.h> would have to become #include "curlx/curlx.h" .

edit: ah since curlx is used by both tool and lib then maybe it would be better to add it to the list of AdditionalIncludeDirectories in the project templates rather than change the #include?

edit2: ok I see now that's what you did in src/Makefile.am so I'll do something similar to AdditionalIncludeDirectories for building the curl tool.

@jay
Copy link
Member
jay commented May 6, 2025 8000

The two fixups when combined with #17263 it works, although the CI won't show it because it won't combine them. I tested just now in Visual Studio 2010 after cherry picking from the other pr

@bagder
Copy link
Member Author
bagder commented May 7, 2025

thanks a lot for your help @jay

bagder added a commit that referenced this pull request May 7, 2025
Move curlx_ functions into its own subdir.

The idea is to use the curlx_ prefix proper on these functions, and use
these same function names both in tool, lib and test suite source code.
Stop the previous special #define setup for curlx_ names.

The printf defines are now done for the library alone. Tests no longer
use the printf defines. The tool code sets its own defines. The printf
functions are not curlx, they are publicly available.

The strcase defines are not curlx_ functions and should not be used by
tool or server code.

dynbuf, warnless, base64 are now proper curlx.

When libcurl is built statically, the functions from the library can be
used as-is. The key is then that the functions must work as-is, without
having to be recompiled for use in tool/tests. This avoids symbol
collisions - when libcurl is built statically, we use those functions
directly when building the tool/tests. When libcurl is shared, we
build/link them separately for the tool/tests.

Assisted-by: Jay Satiro

Closes #17253
@bagder
Copy link
Member Author
bagder commented May 7, 2025

Because of the size of this patch, I'm now thinking I can land this as a first version to reduce merge conflict risks with whatever else is done at the same time as this. Then work on cleaning up the remaining curlx_ functions in follow-up PRs.

@vszakats @icing as this is a monster patch, do you have any concerns before merge?

bagder added a commit that referenced this pull request May 7, 2025
Move curlx_ functions into its own subdir.

The idea is to use the curlx_ prefix proper on these functions, and use
these same function names both in tool, lib and test suite source code.
Stop the previous special #define setup for curlx_ names.

The printf defines are now done for the library alone. Tests no longer
use the printf defines. The tool code sets its own defines. The printf
functions are not curlx, they are publicly available.

The strcase defines are not curlx_ functions and should not be used by
tool or server code.

dynbuf, warnless, base64, strparse, timeval, timediff are now proper
curlx functions.

When libcurl is built statically, the functions from the library can be
used as-is. The key is then that the functions must work as-is, without
having to be recompiled for use in tool/tests. This avoids symbol
collisions - when libcurl is built statically, we use those functions
directly when building the tool/tests. When libcurl is shared, we
build/link them separately for the tool/tests.

Assisted-by: Jay Satiro

Closes #17253
bagder added a commit that referenced this pull request May 7, 2025
Move curlx_ functions into its own subdir.

The idea is to use the curlx_ prefix proper on these functions, and use
these same function names both in tool, lib and test suite source code.
Stop the previous special #define setup for curlx_ names.

The printf defines are now done for the library alone. Tests no longer
use the printf defines. The tool code sets its own defines. The printf
functions are not curlx, they are publicly available.

The strcase defines are not curlx_ functions and should not be used by
tool or server code.

dynbuf, warnless, base64, strparse, timeval, timediff are now proper
curlx functions.

When libcurl is built statically, the functions from the library can be
used as-is. The key is then that the functions must work as-is, without
having to be recompiled for use in tool/tests. This avoids symbol
collisions - when libcurl is built statically, we use those functions
directly when building the tool/tests. When libcurl is shared, we
build/link them separately for the tool/tests.

Assisted-by: Jay Satiro

Closes #17253
Move curlx_ functions into its own subdir.

The idea is to use the curlx_ prefix proper on these functions, and use
these same function names both in tool, lib and test suite source code.
Stop the previous special #define setup for curlx_ names.

The printf defines are now done for the library alone. Tests no longer
use the printf defines. The tool code sets its own defines. The printf
functions are not curlx, they are publicly available.

The strcase defines are not curlx_ functions and should not be used by
tool or server code.

dynbuf, warnless, base64, strparse, timeval, timediff are now proper
curlx functions.

When libcurl is built statically, the functions from the library can be
used as-is. The key is then that the functions must work as-is, without
having to be recompiled for use in tool/tests. This avoids symbol
collisions - when libcurl is built statically, we use those functions
directly when building the tool/tests. When libcurl is shared, we
build/link them separately for the tool/tests.

Assisted-by: Jay Satiro

Closes #17253
@bagder bagder closed this in 255aac5 May 7, 2025
@bagder bagder merged commit 255aac5 into master May 7, 2025
230 checks passed
@bagder bagder deleted the bagder/curlx branch May 7, 2025 09:23
@vszakats
Copy link
Member
vszakats commented May 7, 2025

Thumbs up to merging!

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.

4 participants
0