mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
Expose public garbage collector API for C language
You can now do epic things like this: puts(_gc(xasprintf("%d", 123))); The _gc() API is shorthand for _defer() which works like Go's keyword: const char *s = xasprintf("%d", 123); _defer(free, s); puts(s); Be sure to always use -fno-omit-frame-pointer which makes code fast too. Enjoy! See also #114
This commit is contained in:
parent
0ad609268f
commit
33e8fc8687
26 changed files with 192 additions and 182 deletions
|
@ -33,7 +33,6 @@ extern unsigned char *__relo_end[]; /* αpε */
|
|||
extern uint8_t __zip_start[]; /* αpε */
|
||||
extern uint8_t __zip_end[]; /* αpε */
|
||||
|
||||
long missingno();
|
||||
void mcount(void);
|
||||
unsigned long getauxval(unsigned long);
|
||||
void *mapanon(size_t) vallocesque attributeallocsize((1));
|
||||
|
@ -45,34 +44,35 @@ void exit(int) wontreturn;
|
|||
void _exit(int) libcesque wontreturn;
|
||||
void _Exit(int) libcesque wontreturn;
|
||||
void abort(void) wontreturn noinstrument;
|
||||
void triplf(void) wontreturn noinstrument privileged;
|
||||
int __cxa_atexit(void *, void *, void *) libcesque;
|
||||
int atfork(void *, void *) libcesque;
|
||||
int atexit(void (*)(void)) libcesque;
|
||||
void free_s(void *) paramsnonnull() libcesque;
|
||||
int close_s(int *) paramsnonnull() libcesque;
|
||||
char *getenv(const char *) paramsnonnull() nosideeffect libcesque;
|
||||
int putenv(char *) paramsnonnull();
|
||||
int setenv(const char *, const char *, int) paramsnonnull();
|
||||
int unsetenv(const char *);
|
||||
int clearenv(void);
|
||||
void fpreset(void);
|
||||
void savexmm(void *);
|
||||
void loadxmm(void *);
|
||||
void peekall(void);
|
||||
int issetugid(void);
|
||||
void weakfree(void *) libcesque;
|
||||
bool isheap(void *);
|
||||
void *mmap(void *, uint64_t, int32_t, int32_t, int32_t, int64_t);
|
||||
void *mremap(void *, uint64_t, uint64_t, int32_t, void *);
|
||||
int munmap(void *, uint64_t);
|
||||
int mprotect(void *, uint64_t, int) privileged;
|
||||
int msync(void *, size_t, int);
|
||||
void __print(const void *, size_t);
|
||||
void __print_string(const char *);
|
||||
void *sbrk(intptr_t);
|
||||
int brk(void *);
|
||||
|
||||
bool _isheap(void *);
|
||||
int NtGetVersion(void);
|
||||
long missingno();
|
||||
void __print(const void *, size_t);
|
||||
void __print_string(const char *);
|
||||
void _loadxmm(void *);
|
||||
void _peekall(void);
|
||||
void _savexmm(void *);
|
||||
void _weakfree(void *);
|
||||
void free_s(void *) paramsnonnull() libcesque;
|
||||
int close_s(int *) paramsnonnull() libcesque;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue