Azure IoT common library
Dependents: STM32F746_iothub_client_sample_mqtt f767zi_mqtt iothub_client_sample_amqp iothub_client_sample_http ... more
Diff: strings.c
- Revision:
- 9:079c39803432
- Parent:
- 8:3db46d1e5471
- Child:
- 16:18e7ebd42bb2
diff -r 3db46d1e5471 -r 079c39803432 strings.c --- a/strings.c Fri Aug 12 10:04:46 2016 -0700 +++ b/strings.c Fri Aug 12 13:49:58 2016 -0700 @@ -128,10 +128,11 @@ if (format != NULL) { va_list arg_list; + int length; va_start(arg_list, format); /* Codes_SRS_STRING_07_041: [STRING_construct_sprintf shall determine the size of the resulting string and allocate the necessary memory.] */ - int length = vsnprintf(NULL, 0, format, arg_list); + length = vsnprintf(NULL, 0, format, arg_list); va_end(arg_list); if (length > 0) { @@ -512,9 +513,10 @@ else { va_list arg_list; + int s2Length; va_start(arg_list, format); - int s2Length = vsnprintf(NULL, 0, format, arg_list); + s2Length = vsnprintf(NULL, 0, format, arg_list); va_end(arg_list); if (s2Length < 0) { @@ -530,8 +532,9 @@ else { STRING* s1 = (STRING*)handle; + char* temp; size_t s1Length = strlen(s1->s); - char* temp = (char*)realloc(s1->s, s1Length + s2Length + 1); + temp = (char*)realloc(s1->s, s1Length + s2Length + 1); if (temp != NULL) { s1->s = temp;