Disable linker map generation and improve tinyness

This commit is contained in:
Justine Tunney 2023-06-09 01:23:18 -07:00
parent 23e235b7a5
commit 4b2023ffab
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
39 changed files with 119 additions and 121 deletions

View file

@ -28,9 +28,42 @@ _Hide extern const struct MagnumStr kSockOptnames[];
_Hide extern const struct MagnumStr kTcpOptnames[];
_Hide extern const struct MagnumStr kPollNames[];
char *GetMagnumStr(const struct MagnumStr *, int);
char *DescribeMagnum(char *, const struct MagnumStr *, const char *, int);
__funline char *GetMagnumStr(const struct MagnumStr *ms, int x) {
int i;
for (i = 0; ms[i].x != MAGNUM_TERMINATOR; ++i) {
if (x == MAGNUM_NUMBER(ms, i)) {
return MAGNUM_STRING(ms, i);
}
}
return 0;
}
/**
* Converts errno value to descriptive sentence.
* @return non-null rodata string or null if not found
*/
__funline char *_strerdoc(int x) {
if (x) {
return GetMagnumStr(kErrnoDocs, x);
} else {
return 0;
}
}
/**
* Converts errno value to symbolic name.
* @return non-null rodata string or null if not found
*/
__funline char *_strerrno(int x) {
if (x) {
return GetMagnumStr(kErrnoNames, x);
} else {
return 0;
}
}
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_FMT_MAGNUMSTRS_H_ */

View file

@ -18,6 +18,7 @@
*/
#include "libc/dce.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/magnumstrs.internal.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/str/str.h"