@@ -78,7 +78,7 @@ int s_build_username_query(
7878int aws_mqtt_append_sdk_metrics_to_username (
7979 struct aws_allocator * allocator ,
8080 const struct aws_byte_cursor * original_username ,
81- const struct aws_mqtt_iot_sdk_metrics * metrics ,
81+ const struct aws_mqtt_iot_sdk_metrics_storage * metrics_storage ,
8282 struct aws_byte_buf * output_username ,
8383 size_t * out_full_username_size ) {
8484
@@ -88,7 +88,7 @@ int aws_mqtt_append_sdk_metrics_to_username(
8888 const struct aws_byte_cursor local_original_username =
8989 original_username == NULL ? aws_byte_cursor_from_c_str ("" ) : * original_username ;
9090
91- if (!metrics ) {
91+ if (!metrics_storage ) {
9292 if (out_full_username_size ) {
9393 * out_full_username_size = local_original_username .len ;
9494 }
@@ -100,10 +100,6 @@ int aws_mqtt_append_sdk_metrics_to_username(
100100 return AWS_OP_SUCCESS ;
101101 }
102102
103- if (aws_mqtt_validate_iot_sdk_metrics_utf8 (metrics )) {
104- return AWS_OP_ERR ;
105- }
106-
107103 int result = AWS_OP_ERR ;
108104 // The length of the base username part not including query parameters
109105 size_t base_username_length = 0 ;
@@ -153,8 +149,8 @@ int aws_mqtt_append_sdk_metrics_to_username(
153149 if (!found_sdk ) {
154150 struct aws_uri_param sdk_params = {
155151 .key = sdk_str ,
156- .value =
157- metrics -> library_name . len > 0 ? metrics -> library_name : aws_byte_cursor_from_c_str ("IoTDeviceSDK/C" ),
152+ .value = metrics_storage -> library_name . len > 0 ? metrics_storage -> library_name
153+ : aws_byte_cursor_from_c_str ("IoTDeviceSDK/C" ),
158154 };
159155 aws_array_list_push_back (& params_list , & sdk_params );
160156 }
@@ -240,14 +236,11 @@ struct aws_mqtt_iot_sdk_metrics_storage *aws_mqtt_iot_sdk_metrics_storage_new(
240236
241237 metrics_storage -> allocator = allocator ;
242238
243- struct aws_mqtt_iot_sdk_metrics * storage_view = & metrics_storage -> storage_view ;
244-
245239 if (metrics_options -> library_name .len > 0 ) {
246240 metrics_storage -> library_name = metrics_options -> library_name ;
247241 if (aws_byte_buf_append_and_update (& metrics_storage -> storage , & metrics_storage -> library_name )) {
248242 goto cleanup_storage ;
249243 }
250- storage_view -> library_name = metrics_storage -> library_name ;
251244 }
252245
253246 return metrics_storage ;
@@ -280,7 +273,7 @@ void aws_mqtt_iot_sdk_metrics_storage_destroy(struct aws_mqtt_iot_sdk_metrics_st
280273 aws_mem_release (metrics_storage -> allocator , metrics_storage );
281274}
282275
283- int aws_mqtt_validate_iot_sdk_metrics_utf8 (const struct aws_mqtt_iot_sdk_metrics * metrics ) {
276+ int aws_mqtt_validate_iot_sdk_metrics (const struct aws_mqtt_iot_sdk_metrics * metrics ) {
284277 if (metrics == NULL ) {
285278 return AWS_OP_SUCCESS ;
286279 }
0 commit comments