summaryrefslogtreecommitdiffstats
path: root/subopt-helper.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-03-06 20:41:02 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-03-06 20:41:02 +0000
commit7e253f01715811e0c4f5f5b54317b098f2cd59d9 (patch)
tree785750c4a7fa8498fc9cc7a4ef89c494a7b2c6d0 /subopt-helper.c
parent6cf4aafa36a609b02d5cf106b88cc8b79b9bd9d4 (diff)
downloadmpv-7e253f01715811e0c4f5f5b54317b098f2cd59d9.tar.bz2
mpv-7e253f01715811e0c4f5f5b54317b098f2cd59d9.tar.xz
Get rid of the "set" member of the subopt-parser struct, it made
it impossible to make the those struct variables const. Also it is not really useful, and wastes space. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28862 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subopt-helper.c')
-rw-r--r--subopt-helper.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/subopt-helper.c b/subopt-helper.c
index d1a169220f..6f4bcf6a30 100644
--- a/subopt-helper.c
+++ b/subopt-helper.c
@@ -45,18 +45,11 @@ static char const * parse_float( char const * const str, float * const valp );
* else a non-zero value is returned.
*
*/
-int subopt_parse( char const * const str, opt_t * opts )
+int subopt_parse( char const * const str, const opt_t * opts )
{
int parse_err = 0, idx;
unsigned int parse_pos = 0;
- /* Initialize set member to false. *
- * It is set to true if it was found in str */
- for ( idx=0; opts[idx].name; ++idx )
- {
- opts[idx].set = 0;
- }
-
if ( str )
{
while ( str[parse_pos] && !parse_err )
@@ -101,7 +94,7 @@ int subopt_parse( char const * const str, opt_t * opts )
if( strncmp( &str[parse_pos], opts[idx].name, opt_len ) == 0 )
{
/* option was found */
- opts[idx].set = 1; next = 1;
+ next = 1;
assert( opts[idx].valp && "Need a pointer to store the arg!" );
@@ -196,7 +189,7 @@ else if ( substr_len == opt_len+2 )
strncmp( &str[parse_pos+2], opts[idx].name, opt_len ) == 0 )
{
/* option was found but negated */
- opts[idx].set = 1; next = 1;
+ next = 1;
/* set arg to false */
*((int *)(opts[idx].valp)) = 0;