D29810: Don't use the setenv function after fork

Stefan BrĂ¼ns noreply at phabricator.kde.org
Sun May 24 02:55:41 BST 2020


bruns added inline comments.

INLINE COMMENTS

> kcrash.cpp:689
>  {
> +    static char autorestarted_envvar[] = "KCRASH_AUTO_RESTARTED";
> +    char** environ_end;

move this to the lambda scope, you can also make the var name shorter then.

> kcrash.cpp:698
> +    }
> +    auto end = std::copy(environ, environ_end, environ_data.begin());
> +

`std::copy_if`, instead of a separate `remove_if` pass.

> kcrash.cpp:703
> +                             return strncmp(autorestarted_envvar, s, sizeof(autorestarted_envvar)-1) == 0 &&
> +                                 s[sizeof(autorestarted_envvar)-1] == '=';
> +                         });

the part after the `&&` can be removed when you include the '=' in the static string

REPOSITORY
  R285 KCrash

REVISION DETAIL
  https://phabricator.kde.org/D29810

To: jpalecek, #frameworks
Cc: bruns, apol, anthonyfieroni, kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200524/89f286f6/attachment-0001.htm>


More information about the Kde-frameworks-devel mailing list