Skip to content

Commit

Permalink
Revert "Places where we have const* arguments in source, optionally m…
Browse files Browse the repository at this point in the history
…ark the value as const as well. (Azure#1261)"

This reverts commit 5723678.
  • Loading branch information
danewalton committed Nov 13, 2020
1 parent ae9548d commit 9db1d8f
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 74 deletions.
12 changes: 5 additions & 7 deletions sdk/src/azure/core/az_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ AZ_NODISCARD int64_t az_context_get_expiration(az_context const* context)
// and return the corresponding value. Returns AZ_ERROR_ITEM_NOT_FOUND is there are no nodes
// matching the specified key.
AZ_NODISCARD az_result
az_context_get_value(az_context const* context, void const* const key, void const** out_value)
az_context_get_value(az_context const* context, void const* key, void const** out_value)
{
_az_PRECONDITION_NOT_NULL(context);
_az_PRECONDITION_NOT_NULL(out_value);
Expand All @@ -55,18 +55,16 @@ az_context_get_value(az_context const* context, void const* const key, void cons
}

AZ_NODISCARD az_context
az_context_create_with_expiration(az_context const* const parent, int64_t expiration)
az_context_create_with_expiration(az_context const* parent, int64_t expiration)
{
_az_PRECONDITION_NOT_NULL(parent);
_az_PRECONDITION(expiration >= 0);

return (az_context){ ._internal = { .parent = parent, .expiration = expiration } };
}

AZ_NODISCARD az_context az_context_create_with_value(
az_context const* const parent,
void const* const key,
void const* const value)
AZ_NODISCARD az_context
az_context_create_with_value(az_context const* parent, void const* key, void const* value)
{
_az_PRECONDITION_NOT_NULL(parent);
_az_PRECONDITION_NOT_NULL(key);
Expand All @@ -84,7 +82,7 @@ void az_context_cancel(az_context* ref_context)
ref_context->_internal.expiration = 0; // The beginning of time
}

AZ_NODISCARD bool az_context_has_expired(az_context const* const context, int64_t current_time)
AZ_NODISCARD bool az_context_has_expired(az_context const* context, int64_t current_time)
{
_az_PRECONDITION_NOT_NULL(context);
_az_PRECONDITION(current_time >= 0);
Expand Down
10 changes: 5 additions & 5 deletions sdk/src/azure/core/az_http_policy_logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static az_span _az_http_policy_logging_copy_lengthy_value(az_span ref_log_msg, a
}

static az_result _az_http_policy_logging_append_http_request_msg(
az_http_request const* const request,
az_http_request const* request,
az_span* ref_log_msg)
{
static az_span const auth_header_name = AZ_SPAN_LITERAL_FROM_STR("authorization");
Expand Down Expand Up @@ -124,7 +124,7 @@ static az_result _az_http_policy_logging_append_http_request_msg(
static az_result _az_http_policy_logging_append_http_response_msg(
az_http_response* ref_response,
int64_t duration_msec,
az_http_request const* const request,
az_http_request const* request,
az_span* ref_log_msg)
{
az_span http_response_string = AZ_SPAN_FROM_STR("HTTP Response (");
Expand Down Expand Up @@ -207,7 +207,7 @@ static az_result _az_http_policy_logging_append_http_response_msg(
return AZ_OK;
}

void _az_http_policy_logging_log_http_request(az_http_request const* const request)
void _az_http_policy_logging_log_http_request(az_http_request const* request)
{
uint8_t log_msg_buf[AZ_LOG_MESSAGE_BUFFER_SIZE] = { 0 };
az_span log_msg = AZ_SPAN_FROM_BUFFER(log_msg_buf);
Expand All @@ -218,9 +218,9 @@ void _az_http_policy_logging_log_http_request(az_http_request const* const reque
}

void _az_http_policy_logging_log_http_response(
az_http_response const* const response,
az_http_response const* response,
int64_t duration_msec,
az_http_request const* const request)
az_http_request const* request)
{
uint8_t log_msg_buf[AZ_LOG_MESSAGE_BUFFER_SIZE] = { 0 };
az_span log_msg = AZ_SPAN_FROM_BUFFER(log_msg_buf);
Expand Down
12 changes: 5 additions & 7 deletions sdk/src/azure/core/az_http_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ az_http_request_append_header(az_http_request* ref_request, az_span name, az_spa
}

AZ_NODISCARD az_result az_http_request_get_header(
az_http_request const* const request,
az_http_request const* request,
int32_t index,
az_span* out_name,
az_span* out_value)
Expand All @@ -173,7 +173,7 @@ AZ_NODISCARD az_result az_http_request_get_header(
}

AZ_NODISCARD az_result
az_http_request_get_method(az_http_request const* const request, az_http_method* out_method)
az_http_request_get_method(az_http_request const* request, az_http_method* out_method)
{
_az_PRECONDITION_NOT_NULL(request);
_az_PRECONDITION_NOT_NULL(out_method);
Expand All @@ -183,8 +183,7 @@ az_http_request_get_method(az_http_request const* const request, az_http_method*
return AZ_OK;
}

AZ_NODISCARD az_result
az_http_request_get_url(az_http_request const* const request, az_span* out_url)
AZ_NODISCARD az_result az_http_request_get_url(az_http_request const* request, az_span* out_url)
{
_az_PRECONDITION_NOT_NULL(request);
_az_PRECONDITION_NOT_NULL(out_url);
Expand All @@ -194,8 +193,7 @@ az_http_request_get_url(az_http_request const* const request, az_span* out_url)
return AZ_OK;
}

AZ_NODISCARD az_result
az_http_request_get_body(az_http_request const* const request, az_span* out_body)
AZ_NODISCARD az_result az_http_request_get_body(az_http_request const* request, az_span* out_body)
{
_az_PRECONDITION_NOT_NULL(request);
_az_PRECONDITION_NOT_NULL(out_body);
Expand All @@ -204,7 +202,7 @@ az_http_request_get_body(az_http_request const* const request, az_span* out_body
return AZ_OK;
}

AZ_NODISCARD int32_t az_http_request_headers_count(az_http_request const* const request)
AZ_NODISCARD int32_t az_http_request_headers_count(az_http_request const* request)
{
return request->_internal.headers_length;
}
2 changes: 1 addition & 1 deletion sdk/src/azure/core/az_http_response.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void _az_http_response_reset(az_http_response* ref_response)
}

// internal function to get az_http_response remainder
static az_span _az_http_response_get_remaining(az_http_response const* const response)
static az_span _az_http_response_get_remaining(az_http_response const* response)
{
return az_span_slice_to_end(response->_internal.http_response, response->_internal.written);
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/azure/core/az_json_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
AZ_NODISCARD az_result az_json_reader_init(
az_json_reader* out_json_reader,
az_span json_buffer,
az_json_reader_options const* const options)
az_json_reader_options const* options)
{
_az_PRECONDITION(az_span_size(json_buffer) >= 1);

Expand Down Expand Up @@ -52,7 +52,7 @@ AZ_NODISCARD az_result az_json_reader_chunked_init(
az_json_reader* out_json_reader,
az_span json_buffers[],
int32_t number_of_buffers,
az_json_reader_options const* const options)
az_json_reader_options const* options)
{
_az_PRECONDITION(number_of_buffers >= 1);
_az_PRECONDITION(az_span_size(json_buffers[0]) >= 1);
Expand Down
24 changes: 10 additions & 14 deletions sdk/src/azure/core/az_json_token.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <azure/core/_az_cfg.h>

static az_span _az_json_token_copy_into_span_helper(
az_json_token const* const json_token,
az_json_token const* json_token,
az_span destination)
{
_az_PRECONDITION(json_token->_internal.is_multisegment);
Expand Down Expand Up @@ -40,7 +40,7 @@ static az_span _az_json_token_copy_into_span_helper(
return destination;
}

az_span az_json_token_copy_into_span(az_json_token const* const json_token, az_span destination)
az_span az_json_token_copy_into_span(az_json_token const* json_token, az_span destination)
{
_az_PRECONDITION_VALID_SPAN(destination, json_token->size, false);

Expand Down Expand Up @@ -149,7 +149,7 @@ AZ_NODISCARD static bool _az_json_token_is_text_equal_helper(
}

AZ_NODISCARD bool az_json_token_is_text_equal(
az_json_token const* const json_token,
az_json_token const* json_token,
az_span expected_text)
{
_az_PRECONDITION_NOT_NULL(json_token);
Expand Down Expand Up @@ -243,8 +243,7 @@ AZ_NODISCARD bool az_json_token_is_text_equal(
return az_span_size(expected_text) == 0;
}

AZ_NODISCARD az_result
az_json_token_get_boolean(az_json_token const* const json_token, bool* out_value)
AZ_NODISCARD az_result az_json_token_get_boolean(az_json_token const* json_token, bool* out_value)
{
_az_PRECONDITION_NOT_NULL(json_token);
_az_PRECONDITION_NOT_NULL(out_value);
Expand Down Expand Up @@ -327,7 +326,7 @@ AZ_NODISCARD static az_result _az_json_token_get_string_helper(
}

AZ_NODISCARD az_result az_json_token_get_string(
az_json_token const* const json_token,
az_json_token const* json_token,
char* destination,
int32_t destination_max_size,
int32_t* out_string_length)
Expand Down Expand Up @@ -430,7 +429,7 @@ AZ_NODISCARD az_result az_json_token_get_string(
}

AZ_NODISCARD az_result
az_json_token_get_uint64(az_json_token const* const json_token, uint64_t* out_value)
az_json_token_get_uint64(az_json_token const* json_token, uint64_t* out_value)
{
_az_PRECONDITION_NOT_NULL(json_token);
_az_PRECONDITION_NOT_NULL(out_value);
Expand Down Expand Up @@ -465,7 +464,7 @@ az_json_token_get_uint64(az_json_token const* const json_token, uint64_t* out_va
}

AZ_NODISCARD az_result
az_json_token_get_uint32(az_json_token const* const json_token, uint32_t* out_value)
az_json_token_get_uint32(az_json_token const* json_token, uint32_t* out_value)
{
_az_PRECONDITION_NOT_NULL(json_token);
_az_PRECONDITION_NOT_NULL(out_value);
Expand Down Expand Up @@ -499,8 +498,7 @@ az_json_token_get_uint32(az_json_token const* const json_token, uint32_t* out_va
return az_span_atou32(az_span_slice(scratch, 0, _az_span_diff(remainder, scratch)), out_value);
}

AZ_NODISCARD az_result
az_json_token_get_int64(az_json_token const* const json_token, int64_t* out_value)
AZ_NODISCARD az_result az_json_token_get_int64(az_json_token const* json_token, int64_t* out_value)
{
_az_PRECONDITION_NOT_NULL(json_token);
_az_PRECONDITION_NOT_NULL(out_value);
Expand Down Expand Up @@ -534,8 +532,7 @@ az_json_token_get_int64(az_json_token const* const json_token, int64_t* out_valu
return az_span_atoi64(az_span_slice(scratch, 0, _az_span_diff(remainder, scratch)), out_value);
}

AZ_NODISCARD az_result
az_json_token_get_int32(az_json_token const* const json_token, int32_t* out_value)
AZ_NODISCARD az_result az_json_token_get_int32(az_json_token const* json_token, int32_t* out_value)
{
_az_PRECONDITION_NOT_NULL(json_token);
_az_PRECONDITION_NOT_NULL(out_value);
Expand Down Expand Up @@ -569,8 +566,7 @@ az_json_token_get_int32(az_json_token const* const json_token, int32_t* out_valu
return az_span_atoi32(az_span_slice(scratch, 0, _az_span_diff(remainder, scratch)), out_value);
}

AZ_NODISCARD az_result
az_json_token_get_double(az_json_token const* const json_token, double* out_value)
AZ_NODISCARD az_result az_json_token_get_double(az_json_token const* json_token, double* out_value)
{
_az_PRECONDITION_NOT_NULL(json_token);
_az_PRECONDITION_NOT_NULL(out_value);
Expand Down
11 changes: 5 additions & 6 deletions sdk/src/azure/core/az_json_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
AZ_NODISCARD az_result az_json_writer_init(
az_json_writer* out_json_writer,
az_span destination_buffer,
az_json_writer_options const* const options)
az_json_writer_options const* options)
{
_az_PRECONDITION_NOT_NULL(out_json_writer);

Expand All @@ -40,7 +40,7 @@ AZ_NODISCARD az_result az_json_writer_chunked_init(
az_span first_destination_buffer,
az_span_allocator_fn allocator_callback,
void* user_context,
az_json_writer_options const* const options)
az_json_writer_options const* options)
{
_az_PRECONDITION_NOT_NULL(out_json_writer);
_az_PRECONDITION_NOT_NULL(allocator_callback);
Expand Down Expand Up @@ -93,7 +93,7 @@ _get_remaining_span(az_json_writer* ref_json_writer, int32_t required_size)

// This validation method is used outside of just preconditions, within
// az_json_writer_append_json_text.
static AZ_NODISCARD bool _az_is_appending_value_valid(az_json_writer const* const json_writer)
static AZ_NODISCARD bool _az_is_appending_value_valid(az_json_writer const* json_writer)
{
_az_PRECONDITION_NOT_NULL(json_writer);

Expand Down Expand Up @@ -136,8 +136,7 @@ static AZ_NODISCARD bool _az_is_appending_value_valid(az_json_writer const* cons
}

#ifndef AZ_NO_PRECONDITION_CHECKING
static AZ_NODISCARD bool _az_is_appending_property_name_valid(
az_json_writer const* const json_writer)
static AZ_NODISCARD bool _az_is_appending_property_name_valid(az_json_writer const* json_writer)
{
_az_PRECONDITION_NOT_NULL(json_writer);

Expand All @@ -157,7 +156,7 @@ static AZ_NODISCARD bool _az_is_appending_property_name_valid(
}

static AZ_NODISCARD bool _az_is_appending_container_end_valid(
az_json_writer const* const json_writer,
az_json_writer const* json_writer,
uint8_t byte)
{
_az_PRECONDITION_NOT_NULL(json_writer);
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/azure/iot/az_iot_hub_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ AZ_NODISCARD az_result az_iot_hub_client_init(
az_iot_hub_client* client,
az_span iot_hub_hostname,
az_span device_id,
az_iot_hub_client_options const* const options)
az_iot_hub_client_options const* options)
{
_az_PRECONDITION_NOT_NULL(client);
_az_PRECONDITION_VALID_SPAN(iot_hub_hostname, 1, false);
Expand All @@ -49,7 +49,7 @@ AZ_NODISCARD az_result az_iot_hub_client_init(
}

AZ_NODISCARD az_result az_iot_hub_client_get_user_name(
az_iot_hub_client const* const client,
az_iot_hub_client const* client,
char* mqtt_user_name,
size_t mqtt_user_name_size,
size_t* out_mqtt_user_name_length)
Expand Down Expand Up @@ -132,7 +132,7 @@ AZ_NODISCARD az_result az_iot_hub_client_get_user_name(
}

AZ_NODISCARD az_result az_iot_hub_client_get_client_id(
az_iot_hub_client const* const client,
az_iot_hub_client const* client,
char* mqtt_client_id,
size_t mqtt_client_id_size,
size_t* out_mqtt_client_id_length)
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/azure/iot/az_iot_hub_client_c2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
static const az_span c2d_topic_suffix = AZ_SPAN_LITERAL_FROM_STR("/messages/devicebound/");

AZ_NODISCARD az_result az_iot_hub_client_c2d_parse_received_topic(
az_iot_hub_client const* const client,
az_iot_hub_client const* client,
az_span received_topic,
az_iot_hub_client_c2d_request* out_request)
{
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/azure/iot/az_iot_hub_client_methods.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static const az_span methods_response_topic_result = AZ_SPAN_LITERAL_FROM_STR("r
static const az_span methods_response_topic_properties = AZ_SPAN_LITERAL_FROM_STR("/?$rid=");

AZ_NODISCARD az_result az_iot_hub_client_methods_parse_received_topic(
az_iot_hub_client const* const client,
az_iot_hub_client const* client,
az_span received_topic,
az_iot_hub_client_method_request* out_request)
{
Expand Down Expand Up @@ -77,7 +77,7 @@ AZ_NODISCARD az_result az_iot_hub_client_methods_parse_received_topic(
}

AZ_NODISCARD az_result az_iot_hub_client_methods_response_get_publish_topic(
az_iot_hub_client const* const client,
az_iot_hub_client const* client,
az_span request_id,
uint16_t status,
char* mqtt_topic,
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/azure/iot/az_iot_hub_client_sas.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static const az_span sig_string = AZ_SPAN_LITERAL_FROM_STR(SAS_TOKEN_SIG);
static const az_span se_string = AZ_SPAN_LITERAL_FROM_STR(SAS_TOKEN_SE);

AZ_NODISCARD az_result az_iot_hub_client_sas_get_signature(
az_iot_hub_client const* const client,
az_iot_hub_client const* client,
uint64_t token_expiration_epoch_time,
az_span signature,
az_span* out_signature)
Expand Down Expand Up @@ -81,7 +81,7 @@ AZ_NODISCARD az_result az_iot_hub_client_sas_get_signature(
}

AZ_NODISCARD az_result az_iot_hub_client_sas_get_password(
az_iot_hub_client const* const client,
az_iot_hub_client const* client,
uint64_t token_expiration_epoch_time,
az_span base64_hmac_sha256_signature,
az_span key_name,
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/azure/iot/az_iot_hub_client_telemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ static const az_span telemetry_topic_modules_mid = AZ_SPAN_LITERAL_FROM_STR("/mo
static const az_span telemetry_topic_suffix = AZ_SPAN_LITERAL_FROM_STR("/messages/events/");

AZ_NODISCARD az_result az_iot_hub_client_telemetry_get_publish_topic(
az_iot_hub_client const* const client,
az_iot_message_properties const* const properties,
az_iot_hub_client const* client,
az_iot_message_properties const* properties,
char* mqtt_topic,
size_t mqtt_topic_size,
size_t* out_mqtt_topic_length)
Expand Down
Loading

0 comments on commit 9db1d8f

Please sign in to comment.