@@ -79,47 +79,50 @@ char faust_opt_manager_parse_compile_options(t_faust_opt_manager *x, size_t cons
7979{
8080 char has_include = 0 ;
8181 faust_opt_manager_free_compile_options (x );
82- x -> f_options = getbytes (argc * sizeof (char * ));
83- if (x -> f_options )
82+ if (argc && argv )
8483 {
85- size_t i ;
86- for ( i = 0 ; i < argc ; ++ i )
84+ x -> f_options = getbytes ( argc * sizeof ( char * )) ;
85+ if ( x -> f_options )
8786 {
88- x -> f_options [ i ] = ( char * ) getbytes ( MAXFAUSTSTRING * sizeof ( char )) ;
89- if ( x -> f_options [ i ] )
87+ size_t i ;
88+ for ( i = 0 ; i < argc ; ++ i )
9089 {
91- if (argv [i ].a_type == A_FLOAT )
90+ x -> f_options [i ] = (char * )getbytes (MAXFAUSTSTRING * sizeof (char ));
91+ if (x -> f_options [i ])
9292 {
93- sprintf (x -> f_options [i ], "%i" , (int )argv [i ].a_w .w_float );
94- }
95- else if (argv [i ].a_type == A_SYMBOL && argv [i ].a_w .w_symbol )
96- {
97- sprintf (x -> f_options [i ], "%s" , argv [i ].a_w .w_symbol -> s_name );
98- if (!strncmp (x -> f_options [i ], "-I" , 2 ))
93+ if (argv [i ].a_type == A_FLOAT )
9994 {
100- has_include = 1 ;
95+ sprintf ( x -> f_options [ i ], "%i" , ( int ) argv [ i ]. a_w . w_float ) ;
10196 }
97+ else if (argv [i ].a_type == A_SYMBOL && argv [i ].a_w .w_symbol )
98+ {
99+ sprintf (x -> f_options [i ], "%s" , argv [i ].a_w .w_symbol -> s_name );
100+ if (!strncmp (x -> f_options [i ], "-I" , 2 ))
101+ {
102+ has_include = 1 ;
103+ }
104+ }
105+ else
106+ {
107+ pd_error (x -> f_owner , "faustgen~: option type invalid" );
108+ memset (x -> f_options [i ], 0 , MAXFAUSTSTRING );
109+ }
110+ x -> f_noptions = i + 1 ;
102111 }
103112 else
104113 {
105- pd_error (x -> f_owner , "faustgen~: option type invalid" );
106- memset (x -> f_options [i ], 0 , MAXFAUSTSTRING );
114+ pd_error (x -> f_owner , "faustgen~: memory allocation failed - compile option %i" , (int )i );
115+ x -> f_noptions = i ;
116+ return -1 ;
107117 }
108- x -> f_noptions = i + 1 ;
109- }
110- else
111- {
112- pd_error (x -> f_owner , "faustgen~: memory allocation failed - compile option %i" , (int )i );
113- x -> f_noptions = i ;
114- return -1 ;
115118 }
116119 }
117- }
118- else
119- {
120- pd_error ( x -> f_owner , "faustgen~: memory allocation failed - compile options" ) ;
121- x -> f_noptions = 0 ;
122- return -1 ;
120+ else
121+ {
122+ pd_error ( x -> f_owner , "faustgen~: memory allocation failed - compile options vector" );
123+ x -> f_noptions = 0 ;
124+ return -1 ;
125+ }
123126 }
124127 if (!has_include )
125128 {
0 commit comments