tree-wide: avoid uninitialized warning on _cleanup_ variables

With some versions of the compiler, the _cleanup_ attr makes it think
the variable might be freed/closed when uninitialized, even though it
cannot happen. The added cost is small enough to be worth the benefit,
and optimized builds will help reduce it even further.
This commit is contained in:
Luca Boccassi
2021-04-14 12:25:06 +01:00
parent be084c0dd1
commit c2b2df604b
61 changed files with 106 additions and 106 deletions
+15 -15
View File
@@ -1409,7 +1409,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
case TABLE_TIMESTAMP:
case TABLE_TIMESTAMP_UTC:
case TABLE_TIMESTAMP_RELATIVE: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
char *ret;
p = new(char, FORMAT_TIMESTAMP_MAX);
@@ -1431,7 +1431,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
case TABLE_TIMESPAN:
case TABLE_TIMESPAN_MSEC: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, FORMAT_TIMESPAN_MAX);
if (!p)
@@ -1446,7 +1446,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_SIZE: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, FORMAT_BYTES_MAX);
if (!p)
@@ -1460,7 +1460,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_BPS: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
size_t n;
p = new(char, FORMAT_BYTES_MAX+2);
@@ -1478,7 +1478,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_INT: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, DECIMAL_STR_WIDTH(d->int_val) + 1);
if (!p)
@@ -1490,7 +1490,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_INT8: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, DECIMAL_STR_WIDTH(d->int8) + 1);
if (!p)
@@ -1502,7 +1502,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_INT16: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, DECIMAL_STR_WIDTH(d->int16) + 1);
if (!p)
@@ -1514,7 +1514,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_INT32: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, DECIMAL_STR_WIDTH(d->int32) + 1);
if (!p)
@@ -1526,7 +1526,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_INT64: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, DECIMAL_STR_WIDTH(d->int64) + 1);
if (!p)
@@ -1538,7 +1538,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_UINT: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, DECIMAL_STR_WIDTH(d->uint_val) + 1);
if (!p)
@@ -1550,7 +1550,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_UINT8: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, DECIMAL_STR_WIDTH(d->uint8) + 1);
if (!p)
@@ -1562,7 +1562,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_UINT16: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, DECIMAL_STR_WIDTH(d->uint16) + 1);
if (!p)
@@ -1574,7 +1574,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_UINT32: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, DECIMAL_STR_WIDTH(d->uint32) + 1);
if (!p)
@@ -1586,7 +1586,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_UINT64: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, DECIMAL_STR_WIDTH(d->uint64) + 1);
if (!p)
@@ -1598,7 +1598,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
}
case TABLE_PERCENT: {
_cleanup_free_ char *p;
_cleanup_free_ char *p = NULL;
p = new(char, DECIMAL_STR_WIDTH(d->percent) + 2);
if (!p)