int manager_get_route_table_to_string(const Manager *m, uint32_t table, char **ret) {
_cleanup_free_ char *str = NULL;
const char *s;
+ int r;
assert(m);
assert(ret);
if (!s)
s = hashmap_get(m->route_table_names_by_number, UINT32_TO_PTR(table));
- if (s) {
+ if (s)
/* Currently, this is only used in debugging logs. To not confuse any bug
* reports, let's include the table number. */
- if (asprintf(&str, "%s(%" PRIu32 ")", s, table) < 0)
- return -ENOMEM;
-
- *ret = TAKE_PTR(str);
- return 0;
- }
-
- if (asprintf(&str, "%" PRIu32, table) < 0)
+ r = asprintf(&str, "%s(%" PRIu32 ")", s, table);
+ else
+ r = asprintf(&str, "%" PRIu32, table);
+ if (r < 0)
return -ENOMEM;
*ret = TAKE_PTR(str);