Mercurial > mplayer.hg
annotate osdep/setenv.c @ 24576:6704a924d4aa
According to MSDN a thread must call CoUninitialize once for each successful
call it has made to CoInitialize or CoInitializeEx, including any call that
returns S_FALSE. Only the CoUninitialize call corresponding to the CoInitialize
or CoInitializeEx call that initialized the library can close it.
patch by Gianluigi Tiesi, mplayer netfarm it
author | diego |
---|---|
date | Sun, 23 Sep 2007 20:37:33 +0000 |
parents | 936209c39ed1 |
children | 5cfef41a1771 |
rev | line source |
---|---|
17245 | 1 /* setenv implementation for systems lacking it. */ |
2 | |
21853 | 3 #include "config.h" |
17245 | 4 |
5 #include <stdlib.h> | |
6 #include <string.h> | |
7 #ifndef MP_DEBUG | |
8 #define NDEBUG | |
9 #endif | |
10 #include <assert.h> | |
11 | |
12 int setenv(const char *name, const char *val, int overwrite) | |
13 { | |
14 int len = strlen(name) + strlen(val) + 2; | |
15 char *env = malloc(len); | |
16 if (!env) { return -1; } | |
17 | |
18 assert(overwrite != 0); | |
19 | |
20 strcpy(env, name); | |
21 strcat(env, "="); | |
22 strcat(env, val); | |
23 putenv(env); | |
24 | |
25 return 0; | |
26 } |