Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Aug 5, 2024
1 parent ffa0ae6 commit aa565ee
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 23 deletions.
12 changes: 4 additions & 8 deletions include/aws/common/environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@ AWS_EXTERN_C_BEGIN
* Not thread-safe
*/
AWS_COMMON_API
struct aws_string *aws_get_env(
struct aws_allocator *allocator,
const char *name);
struct aws_string *aws_get_env(struct aws_allocator *allocator, const char *name);

/*
* Get the value of an environment variable. If the variable is not set or is empty, the output string will be set to NULL.
* Not thread-safe
* Get the value of an environment variable. If the variable is not set or is empty, the output string will be set to
* NULL. Not thread-safe
*/
AWS_COMMON_API
struct aws_string *aws_get_env_nonempty(
struct aws_allocator *allocator,
const char *name);
struct aws_string *aws_get_env_nonempty(struct aws_allocator *allocator, const char *name);

/*
* *DEPRECATED*
Expand Down
9 changes: 2 additions & 7 deletions source/posix/environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
#include <aws/common/string.h>
#include <stdlib.h>


struct aws_string *aws_get_env(
struct aws_allocator *allocator,
const char *name) {
struct aws_string *aws_get_env(struct aws_allocator *allocator, const char *name) {

const char *value = getenv(name);
if (value == NULL) {
Expand All @@ -21,9 +18,7 @@ struct aws_string *aws_get_env(
return aws_string_new_from_c_str(allocator, value);
}

struct aws_string *aws_get_env_nonempty(
struct aws_allocator *allocator,
const char *name) {
struct aws_string *aws_get_env_nonempty(struct aws_allocator *allocator, const char *name) {

const char *value = getenv(name);
if (value == NULL || value[0] == '\0') {
Expand Down
8 changes: 2 additions & 6 deletions source/windows/environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

#include <stdlib.h>

struct aws_string *aws_get_env(
struct aws_allocator *allocator,
const char *name) {
struct aws_string *aws_get_env(struct aws_allocator *allocator, const char *name) {

const char *value = getenv(name);
if (value == NULL) {
Expand All @@ -20,9 +18,7 @@ struct aws_string *aws_get_env(
return aws_string_new_from_c_str(allocator, value);
}

struct aws_string *aws_get_env_nonempty(
struct aws_allocator *allocator,
const char *name) {
struct aws_string *aws_get_env_nonempty(struct aws_allocator *allocator, const char *name) {

const char *value = getenv(name);
if (value == NULL || value[0] == '\0') {
Expand Down
2 changes: 0 additions & 2 deletions tests/environment_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ static int s_test_environment_functions_fn(struct aws_allocator *allocator, void

AWS_TEST_CASE(test_environment_functions, s_test_environment_functions_fn)


static int s_test_env_functions_fn(struct aws_allocator *allocator, void *ctx) {
(void)ctx;

Expand All @@ -69,7 +68,6 @@ static int s_test_env_functions_fn(struct aws_allocator *allocator, void *ctx) {
result = aws_set_environment_value(s_test_variable, empty_str);
ASSERT_TRUE(result == AWS_OP_SUCCESS);


value = aws_get_env(allocator, env_name);
ASSERT_TRUE(aws_string_compare(value, empty_str) == 0);
aws_string_destroy(value);
Expand Down

0 comments on commit aa565ee

Please sign in to comment.