Bug 395303 - Add check: prefer qgetenv/qputenv over the C library functions getenv/putenv/setenv
Summary: Add check: prefer qgetenv/qputenv over the C library functions getenv/putenv/...
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other All
: NOR wishlist
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-13 07:18 UTC by Richard
Modified: 2018-08-15 18:40 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard 2018-06-13 07:18:12 UTC
getenv and putenv are not threadsafe. But the Qt wrappers use external synchronisation (a mutex) to ensure that. Also the interface of the Qt functions is easier to use correctly.
Comment 1 Sergio Martins 2018-08-15 18:40:49 UTC
Git commit 70032c8ed25345da49578e8d1b7db22fa17c7eed by Sergio Martins.
Committed on 15/08/2018 at 18:40.
Pushed by smartins into branch 'master'.

Introduce raw-environment-function

Suggests qputenv/qgetenv instead of putenv/getenv.
Disabled by default. Enable it manually if you need the thread-safety guarantees
of the Qt equivalents.

M  +1    -0    Changelog
M  +1    -0    CheckSources.cmake
M  +1    -0    README.md
M  +6    -0    checks.json
A  +5    -0    docs/checks/README-raw-environment-function.md
M  +1    -0    readmes.cmake
M  +2    -0    src/Checks.h
A  +55   -0    src/checks/manuallevel/raw-environment-function.cpp     [License: LGPL (v2+)]
A  +38   -0    src/checks/manuallevel/raw-environment-function.h     [License: LGPL (v2+)]
A  +7    -0    tests/raw-environment-function/config.json
A  +16   -0    tests/raw-environment-function/main.cpp     [License: UNKNOWN]  *
A  +3    -0    tests/raw-environment-function/main.cpp.expected

The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://commits.kde.org/clazy/70032c8ed25345da49578e8d1b7db22fa17c7eed