-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Split up util.cpp/h #4748
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
Split up util.cpp/h #4748
Conversation
|
Looks great, I'm verifying the c/p now. Several dependencies on boost could be dropped, I assume you're leaving that for a follow-up? |
|
Verfied the code movement with c/p, all is clean with 2 exceptions. I'm only mentioning these for the sake of being thorough, I assume they're harmless. GetTimeMicros and MilliSleep have moved from inline->non-inline. I have no clue if they actually ended up being inlined for real when compiled before, but if so, that may mean a functional change here due to the timing/precision involved. That aside, ACK. |
|
If you see any further dependencies on boost - especially includes in headers - that can be removed let me know. This has the overall effect of including less boost headers per compilation unit which means faster compile times. And indeed: |
04db80f to
d9e45ae
Compare
|
PASSED! Hah, take that @BitcoinPullTester (for some reason the pulltester environment requires some more explicit #includes of boost/thread.hpp, so had to add those one by one, sorry for the spam) |
|
@laanwj re: inlines, sounds good. As for the boost deps, I'm not sure if there are others, but I noticed this one right away in utilstring.cpp -> That would mean dropping boost completely for that object. |
|
@theuni I thought about that, although I like keeping FOREACH, so that they can be easily replaced when the time for c++11 comes. |
|
I havent verified the c/p yet (will do that after squash before merge), but you've definitely got my conceptual ACK. I might consider changing utilmoney to uilmoneystr or just moneystr, utilstring to utilstrencodings or something and splitting the new util up further into something like arguments/env and logging (but that may be better in a separate pull because some of it isnt clear). |
src/rpcprotocol.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2x version.h?
|
Untested ACK; I didn't verify it to be move-only. |
|
@TheBlueMatt I'm not going to do any further splitting in this pull. Those renames sound fine to me though. |
ea0f29e to
e084db7
Compare
|
ut (but verified cp) ACK |
|
ut ACK "utilstrencodings" is a lame name. utilstrcode or strutil ? |
|
Untested ACK, but verified move-only. I will refrain from joining the filename bikeshedding. |
|
@jgarzik It was just utilstring, then I renamed it after @TheBlueMatt complained about the name once already. I won't keep renaming them. Go fight it out with him first.. |
|
@jgarzik now its bikeshedding, I dont care either way, it was just a suggestion. |
Now that we no longer use the median filter to keep track of the number of blocks of peers, that's the only place it is used.
Put the THREAD_* and PRIO_ constants in compat.h.
Breaks compile-time dependency of wallet.h on util.
Eventually these should end up in `money.h` after monetary amounts are typedef'ed, but at least they don't belong in `util.h`.
Split up util.cpp/h into: - string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach) - money utilities (parsesmoney, formatmoney) - time utilities (gettime*, sleep, format date): - and the rest (logging, argument parsing, config file parsing) The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (Matt suggested osinterface). Breaks dependency of sha256.cpp on all the things pulled in by util.
e084db7 to
ad49c25
Compare
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4748_ad49c256c33bfe4088fd3c7ecb7d28cb81a8fc70/ for binaries and test log. |
|
Merging, as this will likely be outdated soon otherwise. File renames can easily be done later if necessary. |
ad49c25 Split up util.cpp/h (Wladimir J. van der Laan) f841aa2 Move `COIN` and `CENT` to core.h (Wladimir J. van der Laan) 6e5fd00 Move `*Version()` functions to version.h/cpp (Wladimir J. van der Laan) b4aa769 Move `S_I*` constants and `MSG_NOSIGNAL` to compat.h (Wladimir J. van der Laan) af8297c Move functions in wallet.h to implementation file (Wladimir J. van der Laan) 651480c move functions in main and net to implementation files (Wladimir J. van der Laan) 610a8c0 Move SetThreadPriority implementation to util.cpp instead of the header (Wladimir J. van der Laan) f780e65 Remove unused function `ByteReverse` from util.h (Wladimir J. van der Laan) 121d6ad Remove unused `alignup` function from util.h (Wladimir J. van der Laan) d1e26d4 Move CMedianFilter to timedata.cpp (Wladimir J. van der Laan)
Updates `tinyformat.h` to commit c42f/tinyformat@3a33bbf upstream. Makes sure that our local changes are kept: - bitcoin#3767 1b8fd35 Make tinyformat errors raise an exception instead of assert()ing - bitcoin#4735 9b6d4c5 Move strprintf define to tinyformat.h - bitcoin#4748 6e5fd00 include stdexcept (for std::exception) - bitcoin#8000 9eaa0af force USE_VARIADIC_TEMPLATES - Add `std::string format(const std::string &fmt...` added this at the time, as we want to be able to do `strprintf(_(...), ...)` Inspired by bitcoin#8264.
util: Update tinyformat Updates `tinyformat.h` to commit c42f/tinyformat@3a33bbf upstream. Makes sure that our local changes are kept: - bitcoin/bitcoin#3767 1b8fd35 Make tinyformat errors raise an exception instead of assert()ing - bitcoin/bitcoin#4735 9b6d4c5 Move strprintf define to tinyformat.h - bitcoin/bitcoin#4748 6e5fd00 include stdexcept (for std::exception) - bitcoin/bitcoin#8000 9eaa0af force USE_VARIADIC_TEMPLATES - Add `std::string format(const std::string &fmt...` added this at the time, as we want to be able to do `strprintf(_(...), ...)` Inspired by bitcoin/bitcoin#8264. For Zcash: ref #1349
Updates `tinyformat.h` to commit c42f/tinyformat@3a33bbf upstream. Makes sure that our local changes are kept: - bitcoin#3767 1b8fd35 Make tinyformat errors raise an exception instead of assert()ing - bitcoin#4735 9b6d4c5 Move strprintf define to tinyformat.h - bitcoin#4748 6e5fd00 include stdexcept (for std::exception) - bitcoin#8000 9eaa0af force USE_VARIADIC_TEMPLATES - Add `std::string format(const std::string &fmt...` added this at the time, as we want to be able to do `strprintf(_(...), ...)` Inspired by bitcoin#8264.
Updates `tinyformat.h` to commit c42f/tinyformat@3a33bbf upstream. Makes sure that our local changes are kept: - bitcoin#3767 1b8fd35 Make tinyformat errors raise an exception instead of assert()ing - bitcoin#4735 9b6d4c5 Move strprintf define to tinyformat.h - bitcoin#4748 6e5fd00 include stdexcept (for std::exception) - bitcoin#8000 9eaa0af force USE_VARIADIC_TEMPLATES - Add `std::string format(const std::string &fmt...` added this at the time, as we want to be able to do `strprintf(_(...), ...)` Inspired by bitcoin#8264.
100% code movement, no functional changes.
Split up util.cpp/h into:
The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (@TheBlueMatt suggested osinterface).
Some unused functions have been completely removed, some functions of limited use that are only used in one place have been moved where they are used (see commits).
Breaks dependency of sha256.cpp on all the things pulled in by util. This makes many include-time dependencies explicit, which before were 'inherited' from include files.