aws-c-common
aws-c-common copied to clipboard
Update aws_get_environment_value to return NULL for empty values
Description of changes:
aws_get_environment_value is error-prone because one of the frequent use cases is to check an environment variable, else check other source like config file. In that case, the previous implementation required us to check three cases:
- NULL -> check the alternative
- Empty -> destroy and check the alternative
- Available -> use that Since we don't need to differentiate between empty values and unset values, treat empty environment values as unset.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 84.23%. Comparing base (
9fd58f9) to head (df47f62).
Additional details and impacted files
@@ Coverage Diff @@
## main #1141 +/- ##
==========================================
+ Coverage 84.21% 84.23% +0.01%
==========================================
Files 57 57
Lines 5973 5980 +7
==========================================
+ Hits 5030 5037 +7
Misses 943 943
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Since we don't need to differentiate between empty values and unset values, treat empty environment values as unset.
This is a pretty big assumption since you're not only asserting it for right now, but for everything that comes in the future too. I don't really agree with this.