diff libvo/vo_md5sum.c @ 14538:00c3c4111017

New suboption type: malloc'ed, zero terminated string
author reimar
date Wed, 19 Jan 2005 17:10:20 +0000
parents 3673ad04ebfb
children ba555409718b
line wrap: on
line diff
--- a/libvo/vo_md5sum.c	Wed Jan 19 17:03:59 2005 +0000
+++ b/libvo/vo_md5sum.c	Wed Jan 19 17:10:20 2005 +0000
@@ -103,9 +103,8 @@
 
 static uint32_t preinit(const char *arg)
 {
-    strarg_t outfile = {0, NULL};
     opt_t subopts[] = {
-        {"outfile",     OPT_ARG_STR,    &outfile,   NULL},
+        {"outfile",     OPT_ARG_MSTRZ,    &md5sum_outfile,   NULL},
         {NULL}
     };
 
@@ -114,18 +113,11 @@
     mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name,
                                             MSGTR_VO_ParsingSuboptions);
 
+    md5sum_outfile = strdup("md5sums");
     if (subopt_parse(arg, subopts) != 0) {
         return -1;
     }
 
-    if (outfile.len) {
-        md5sum_outfile = malloc(outfile.len + 1);
-        memcpy(md5sum_outfile, outfile.str, outfile.len);
-        md5sum_outfile[outfile.len] = '\0';
-    } else {
-        md5sum_outfile = strdup("md5sums");
-    }
-
     mp_msg(MSGT_VO, MSGL_V, "%s: outfile --> %s\n", info.short_name,
                                                             md5sum_outfile);