Commit graph

12 commits

Author SHA1 Message Date
Michael Keller
e65c7cedc8 Refactoring: Improve Naming of FRACTION and SIGNED_FRAC defines.
Make it more obvious that the FRACTION and SIGNED_FRAC defines return a
tuple / triplet of values.

Fixes https://github.com/subsurface/subsurface/pull/4171#discussion_r1585941133

Complained-about-by: @bstoeger
Signed-off-by: Michael Keller <github@ike.ch>
2024-05-02 20:36:26 +02:00
Berthold Stoeger
556ecd5a9b core: use C++-primitives for g_tag_list
The old code was leaking memory. Use std::unique_ptr<> for
ownership management.

This is still very primitive and divetags are kept during
application lifetime. There should probably be some form
of reference counting. And the taglist should not be global,
but attached to the divelog.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
a123589efb core: convert git_info to std::string
Quite a bit of fallout in users of this structure.

Conveniently, since git-access.cpp is now C++ we can move
some helpers from the monstrous qthelper.cpp to git-access.cpp.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
41cb916060 core: turn existing_filename into std::string
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
8980d61786 core: replace SSRF_INFO macro by report_info()
The point of this macro is unclear. It just calls report_info()
anyway...

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-12 10:31:07 -04:00
Berthold Stoeger
119fe908c7 core: port filterpreset.cpp to std::string
Less memory management hassle.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
2e1d852e36 core: convert filter_constraint_data_to_string to C++
Return an std::string to avoid memory management headaches.

While doing that, convert time.c to C++ so that
format_datetime directly returns an std::string.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
898ecd2df5 core: make fp_get_data return an std::string
No need for manual memory management.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
a1826f77da core: turn saved_git_id into a std::string
Simplifies memory management. Think about unglobalizing this,
once everything is in C++ so that we can put an std::string
into struct divelog.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
f1012283a0 core: turn a few string helpers into C++
get_changes_made(), subsurface_user_agent() and normalize_cloud_name()
are only called from C++.

Avoids having to manually free the returned value and is therefore
more robust against leaks.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
b0438ad1dd core: use C++-style memory management for struct dir
The code is now much easier to check for memory leaks,
since there are no explicit free()s. Yes, memory is not
released immediately, but that should be of no concern.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Berthold Stoeger
371b155922 core: convert core/save-git.c to C++
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Renamed from core/save-git.c (Browse further)