Mercurial > mplayer.hg
annotate mp_strings.c @ 33560:16cf555989a9
Add support for converting to interleaved 3D in vf_stereo3d.
Patch by Steaphan Greene [sgreene cs.binghamton.edu]
author | reimar |
---|---|
date | Sun, 19 Jun 2011 08:33:57 +0000 |
parents | ca6dcdb31fa1 |
children | 2ef9298a81e7 |
rev | line source |
---|---|
32883 | 1 /* |
2 * Strings utilities | |
3 * | |
4 * This file is part of MPlayer. | |
5 * | |
6 * MPlayer is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * MPlayer is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License along | |
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 */ | |
20 | |
21 #include <stdlib.h> | |
22 #include <stdarg.h> | |
23 #include <stdio.h> | |
32949
ca6dcdb31fa1
Cosmetics: add empty line between system and local headers and remove pointless
cboesch
parents:
32883
diff
changeset
|
24 |
32883 | 25 #include "mp_strings.h" |
26 | |
27 char *mp_asprintf(const char *fmt, ...) | |
28 { | |
29 char *p = NULL; | |
30 va_list va, va_bak; | |
31 int len; | |
32 | |
33 va_start(va, fmt); | |
34 va_copy(va_bak, va); | |
35 | |
36 len = vsnprintf(NULL, 0, fmt, va); | |
37 if (len < 0) | |
38 goto end; | |
39 | |
40 p = malloc(len + 1); | |
41 if (!p) | |
42 goto end; | |
43 | |
44 len = vsnprintf(p, len + 1, fmt, va_bak); | |
45 if (len < 0) | |
46 free(p), p = NULL; | |
47 | |
48 end: | |
49 va_end(va); | |
50 return p; | |
51 } |