Skip to content

Commit 5806b17

Browse files
committed
Layout, indents and removed compiler warning.
1 parent 83c437f commit 5806b17

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

cores/arduino/Print.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -267,30 +267,30 @@ size_t Print::printFloat(double number, uint8_t digits)
267267

268268
size_t Print::printf(const char *format, ...)
269269
{
270-
char loc_buf[64];
271-
char * temp = loc_buf;
272-
va_list arg;
273-
va_list copy;
274-
va_start(arg, format);
275-
va_copy(copy, arg);
276-
int len = vsnprintf(temp, sizeof(loc_buf), format, copy);
277-
va_end(copy);
278-
if(len < 0) {
279-
va_end(arg);
280-
return 0;
281-
};
282-
if(len >= sizeof(loc_buf)){
283-
temp = (char*) malloc(len+1);
284-
if(temp == NULL) {
285-
va_end(arg);
286-
return 0;
287-
}
288-
len = vsnprintf(temp, len+1, format, arg);
289-
}
270+
char loc_buf[64];
271+
char* temp = loc_buf;
272+
va_list arg;
273+
va_list copy;
274+
va_start(arg, format);
275+
va_copy(copy, arg);
276+
int len = vsnprintf(temp, sizeof(loc_buf), format, copy);
277+
va_end(copy);
278+
if (len < 0) {
290279
va_end(arg);
291-
len = write((uint8_t*)temp, len);
292-
if(temp != loc_buf){
293-
free(temp);
280+
return 0;
281+
}
282+
if (len >= (int)sizeof(loc_buf)) {
283+
temp = (char*)malloc(len + 1);
284+
if (temp == NULL) {
285+
va_end(arg);
286+
return 0;
294287
}
295-
return len;
288+
len = vsnprintf(temp, len + 1, format, arg);
289+
}
290+
va_end(arg);
291+
len = write((uint8_t*)temp, len);
292+
if (temp != loc_buf) {
293+
free(temp);
294+
}
295+
return len;
296296
}

0 commit comments

Comments
 (0)