Fix bug involving _mixin producing conflicting symbols: now using `gnu_inilne` (macro"d to `force_inline`), instead of `always_inline` Fortune for naka's current commit: Blessing − 吉generic-project-skeleton
parent
fb2fa5801e
commit
672502449b
@ -0,0 +1,34 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <version.h>
|
||||
|
||||
usize v_ctosn(version_t ver, usize max, char out[static pOUT max])
|
||||
{
|
||||
struct v_comp comp = ver.comp;
|
||||
const char* const fmt = comp.revision ? "%hhu.%hhu.%hhur%hhu" : "%hhu.%hhu.%hhu";
|
||||
|
||||
|
||||
return snprintf(out, max, fmt,
|
||||
comp.major,
|
||||
comp.minor,
|
||||
comp.bugfix,
|
||||
comp.revision);
|
||||
}
|
||||
|
||||
const char* v_ctoss(version_t ver)
|
||||
{
|
||||
_Thread_local static char buffer[VERSION_STRING_MAX+1];
|
||||
buffer[v_ctosn(ver, VERSION_STRING_MAX+1, buffer)] = 0;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
char* v_ctos(version_t ver)
|
||||
{
|
||||
usize sz = v_ctosn_sz(ver);
|
||||
char* buf = malloc(sz+1);
|
||||
v_ctosn(ver, sz+1, buf);
|
||||
return buf;
|
||||
}
|
||||
|
Loading…
Reference in new issue