mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Make some quick fixes and cleanup
This commit is contained in:
parent
fa5c2a24b5
commit
61257d48d4
63 changed files with 275 additions and 257 deletions
|
@ -16,39 +16,12 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/fmt/magnumstrs.internal.h"
|
||||
#include "libc/intrin/describeflags.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/sol.h"
|
||||
|
||||
static inline char *StpCpy(char *d, const char *s) {
|
||||
size_t i;
|
||||
for (i = 0;; ++i) {
|
||||
if (!(d[i] = s[i])) {
|
||||
return d + i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes clock_gettime() clock argument.
|
||||
*/
|
||||
const char *(DescribeClockName)(char buf[32], int x) {
|
||||
int i;
|
||||
char *s, *p;
|
||||
if ((s = GetMagnumStr(kClockNames, x))) {
|
||||
p = buf;
|
||||
*p++ = 'C';
|
||||
*p++ = 'L';
|
||||
*p++ = 'O';
|
||||
*p++ = 'C';
|
||||
*p++ = 'K';
|
||||
*p++ = '_';
|
||||
StpCpy(p, s);
|
||||
return buf;
|
||||
} else {
|
||||
FormatInt32(buf, x);
|
||||
return buf;
|
||||
}
|
||||
return DescribeMagnum(buf, kClockNames, "CLOCK_", x);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue