Mercurial > mplayer.hg
annotate osdep/setenv.c @ 24424:0c4f1a88eaae
warning fixes:
input.c: In function 'mp_input_set_section':
input.c:1640: warning: suggest parentheses around assignment used as truth value
input.c:1643: warning: suggest parentheses around assignment used as truth value
mga_common.c: In function 'mga_init':
mga_common.c:394: warning: suggest parentheses around assignment used as truth value
playtreeparser.c: In function 'parse_smil':
playtreeparser.c:523: warning: suggest parentheses around assignment used as truth value
libmpdemux/demux_ts.c: In function 'ts_parse':
libmpdemux/demux_ts.c:2795: warning: suggest parentheses around assignment used as truth value
libmpdemux/demux_ts.c: In function 'demux_open_ts':
libmpdemux/demux_ts.c:591: warning: 'frame_length' may be used uninitialized in this function
author | diego |
---|---|
date | Thu, 13 Sep 2007 13:16:30 +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 } |