X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Fstring-utils%2Fformat.hpp;fp=src%2Fcommon%2Fstring-utils%2Fformat.hpp;h=244652332f1eee0d60a541baef9e53739b82b8b3;hb=7532fa3bd22e403958f46cd35c824f490d93292d;hp=0000000000000000000000000000000000000000;hpb=985aea182b618c85c51651f224abedfe367c75ee;p=deliverable%2Flttng-tools.git diff --git a/src/common/string-utils/format.hpp b/src/common/string-utils/format.hpp new file mode 100644 index 000000000..244652332 --- /dev/null +++ b/src/common/string-utils/format.hpp @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2019 Jérémie Galarneau + * + * SPDX-License-Identifier: LGPL-2.1-only + * + */ + +#ifndef _STRING_UTILS_FORMAT_H +#define _STRING_UTILS_FORMAT_H + +/* + * Maximal length of `val` when formatted in decimal. + * + * Note that this is an upper bound that can exceed the length + * required to hold the largest textual value of `val`. Note that this length + * assumes that no grouping/locale-aware formatting is performed (i.e. using + * the `'` specifier in POSIX formatting functions). + */ +#define MAX_INT_DEC_LEN(val) ((3 * sizeof(val)) + 2) + +#endif /* _STRING_UTILS_FORMAT_H */