From: Ralf Wildenhues Date: Sun, 25 May 2008 21:10:42 +0000 (+0200) Subject: Simplify argument parsing in cwrapper. X-Git-Tag: v2.2.6~34 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=1113cea29ec34b7c3cf1c0a3f2ebf1b7b05977e3;p=thirdparty%2Flibtool.git Simplify argument parsing in cwrapper. * libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src): Use NULL where appropriate. Do not compute length of arguments needlessly. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 276d9b6ea..97eea586b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-05-26 Ralf Wildenhues + + Simplify argument parsing in cwrapper. + * libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src): + Use NULL where appropriate. Do not compute length of arguments + needlessly. + 2008-05-25 Charles Wilson [mingw] Add cross-compile support to cwrapper diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index cfdfdf956..144bc76b0 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -3005,7 +3005,7 @@ EOF /* DO want the lt- prefix here if it exists, so use target_name */ lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); XFREE (tmp_pathspec); - tmp_pathspec = 0; + tmp_pathspec = NULL; EOF case $host_os in @@ -3039,19 +3039,16 @@ EOF newargc=0; for (i = 1; i < argc; i++) { - size_t arglen = strlen (argv[i]); if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0) { - if ((arglen > env_set_opt_len) && (argv[i][env_set_opt_len] == '=')) + if (argv[i][env_set_opt_len] == '=') { const char *p = argv[i] + env_set_opt_len + 1; lt_opt_process_env_set (p); } - else if ((arglen == env_set_opt_len) && - (i + 1 < argc)) + else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc) { - lt_opt_process_env_set (argv[i + 1]); - i++; /* don't copy */ + lt_opt_process_env_set (argv[++i]); /* don't copy */ } else lt_fatal ("%s missing required argument", env_set_opt); @@ -3059,17 +3056,14 @@ EOF } if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0) { - if ((arglen > env_prepend_opt_len) && - (argv[i][env_prepend_opt_len] == '=')) + if (argv[i][env_prepend_opt_len] == '=') { const char *p = argv[i] + env_prepend_opt_len + 1; lt_opt_process_env_prepend (p); } - else if ((arglen == env_prepend_opt_len) && - (i + 1 < argc)) + else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc) { - lt_opt_process_env_prepend (argv[i + 1]); - i++; /* don't copy */ + lt_opt_process_env_prepend (argv[++i]); /* don't copy */ } else lt_fatal ("%s missing required argument", env_prepend_opt); @@ -3077,17 +3071,14 @@ EOF } if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0) { - if ((arglen > env_append_opt_len) && - (argv[i][env_append_opt_len] == '=')) + if (argv[i][env_append_opt_len] == '=') { const char *p = argv[i] + env_append_opt_len + 1; lt_opt_process_env_append (p); } - else if ((arglen == env_append_opt_len) && - (i + 1 < argc)) + else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc) { - lt_opt_process_env_append (argv[i + 1]); - i++; /* don't copy */ + lt_opt_process_env_append (argv[++i]); /* don't copy */ } else lt_fatal ("%s missing required argument", env_append_opt);