mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
Use unsigned leb128 for magnums
This commit is contained in:
parent
edd9297eba
commit
cdc54ea1fd
931 changed files with 1989 additions and 1983 deletions
|
@ -25,9 +25,24 @@
|
|||
|
||||
#define MAX_VARS 512
|
||||
|
||||
static bool once;
|
||||
|
||||
static void PutEnvInit(void) {
|
||||
char **pin, **pout;
|
||||
pin = environ;
|
||||
pout = malloc(sizeof(char *) * MAX_VARS);
|
||||
environ = pout;
|
||||
while (*pin) *pout++ = strdup(*pin++);
|
||||
*pout = NULL;
|
||||
}
|
||||
|
||||
int PutEnvImpl(char *s, bool overwrite) {
|
||||
char *p;
|
||||
unsigned i, namelen;
|
||||
if (!once) {
|
||||
PutEnvInit();
|
||||
once = true;
|
||||
}
|
||||
p = strchr(s, '=');
|
||||
if (!p) goto fail;
|
||||
namelen = p + 1 - s;
|
||||
|
@ -58,14 +73,3 @@ fail:
|
|||
int putenv(char *string) {
|
||||
return PutEnvImpl(strdup(string), true);
|
||||
}
|
||||
|
||||
textstartup static void putenv_init(void) {
|
||||
char **pin, **pout;
|
||||
pin = environ;
|
||||
pout = malloc(sizeof(char *) * MAX_VARS);
|
||||
environ = pout;
|
||||
while (*pin) *pout++ = strdup(*pin++);
|
||||
*pout = NULL;
|
||||
}
|
||||
|
||||
const void *const putenv_ctor[] initarray = {putenv_init};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue