Summary Files Commits Branches @commit @diff @stats
path: root / fmt.c
diff options
context:
space:
mode:
1 files changed, 7 insertions, 2 deletions
-rw-r--r--fmt.c9
diff --git a/fmt.c b/fmt.c
index f22fcce..0c47e00 100644
--- a/fmt.c
+++ b/fmt.c
@@ -7,11 +7,11 @@
/* flawfinder: ignore. `alpha_digits` is never modified */
static const char alpha_digits[26] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
void
-fmt_context_id(uint64_t num, char *out)
+fmt_context_id(uint64_t num, char *out, int withSeparator)
{
/* flawfinder: ignore. bound checks are done */
char buf[BADWOLF_CTX_SIZ] = {0, 0, 0, 0, 0, 0, 0};
- int len = 0;
+ int len = 2;
buf[++len] = alpha_digits[num % 26];
num /= 26;
@@ -25,4 +25,9 @@ fmt_context_id(uint64_t num, char *out)
{
out[i] = buf[len - i];
}
+
+ if (withSeparator) {
+ out[len - 2] = ':';
+ out[len - 1] = ' ';
+ }
}