Skip to content

Commit

Permalink
comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
TingDaoK committed Dec 28, 2023
1 parent eb70a19 commit 7bde526
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions include/aws/common/uri.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ AWS_COMMON_API const struct aws_byte_cursor *aws_uri_path_and_query(const struct
* 2) Blank entries are skipped.
* Example: The only param in query string "&&a=b" is key="a" value="b"
*/
AWS_COMMON_API bool aws_query_string_next_param(
const struct aws_byte_cursor *query_string,
struct aws_uri_param *param);
AWS_COMMON_API bool aws_query_string_next_param(struct aws_byte_cursor query_string, struct aws_uri_param *param);

/**
* Parses query string and stores the parameters in 'out_params'. Returns AWS_OP_SUCCESS on success and
Expand Down
8 changes: 4 additions & 4 deletions source/uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ uint16_t aws_uri_port(const struct aws_uri *uri) {
return uri->port;
}

bool aws_query_string_next_param(const struct aws_byte_cursor *query_string_cursor, struct aws_uri_param *param) {
bool aws_query_string_next_param(struct aws_byte_cursor query_string, struct aws_uri_param *param) {
/* If param is zeroed, then this is the first run. */
bool first_run = param->value.ptr == NULL;

Expand All @@ -230,7 +230,7 @@ bool aws_query_string_next_param(const struct aws_byte_cursor *query_string_curs

/* The do-while is to skip over any empty substrings */
do {
if (!aws_byte_cursor_next_split(query_string_cursor, '&', &substr)) {
if (!aws_byte_cursor_next_split(&query_string, '&', &substr)) {
/* no more splits, done iterating */
return false;
}
Expand All @@ -255,7 +255,7 @@ bool aws_query_string_next_param(const struct aws_byte_cursor *query_string_curs
int aws_query_string_params(struct aws_byte_cursor query_string_cursor, struct aws_array_list *out_params) {
struct aws_uri_param param;
AWS_ZERO_STRUCT(param);
while (aws_query_string_next_param(&query_string_cursor, &param)) {
while (aws_query_string_next_param(query_string_cursor, &param)) {
if (aws_array_list_push_back(out_params, &param)) {
return AWS_OP_ERR;
}
Expand All @@ -265,7 +265,7 @@ int aws_query_string_params(struct aws_byte_cursor query_string_cursor, struct a
}

bool aws_uri_query_string_next_param(const struct aws_uri *uri, struct aws_uri_param *param) {
return aws_query_string_next_param(&uri->query_string, param);
return aws_query_string_next_param(uri->query_string, param);
}

int aws_uri_query_string_params(const struct aws_uri *uri, struct aws_array_list *out_params) {
Expand Down

0 comments on commit 7bde526

Please sign in to comment.