chiark / gitweb /
stick to C89 and avoid mixed declarations and code; thanks to Benoit Scherrer for...
authorstevenj <stevenj@alum.mit.edu>
Fri, 30 Jul 2010 00:54:19 +0000 (20:54 -0400)
committerstevenj <stevenj@alum.mit.edu>
Fri, 30 Jul 2010 00:54:19 +0000 (20:54 -0400)
darcs-hash:20100730005419-c8de0-39dc04e5a2be81512bb3ca87c6fa397192e5bfd7.gz

api/optimize.c
api/options.c

index e52216d6afe8e03eaa8284bcf90cd2155b60f34c..cfaa3c5d92452d6cc76993f4710815ccde813ae8 100644 (file)
@@ -371,9 +371,9 @@ static nlopt_result nlopt_optimize_(nlopt_opt opt, double *x, double *minf)
         case NLOPT_GD_MLSL:
         case NLOPT_GN_MLSL_LDS:
         case NLOPT_GD_MLSL_LDS: {
-             if (!finite_domain(n, lb, ub)) return NLOPT_INVALID_ARGS;
              nlopt_opt local_opt = opt->local_opt;
              nlopt_result ret;
+             if (!finite_domain(n, lb, ub)) return NLOPT_INVALID_ARGS;
              if (!local_opt && (algorithm == NLOPT_G_MLSL 
                                 || algorithm == NLOPT_G_MLSL_LDS))
                   return NLOPT_INVALID_ARGS;
index d934f71e25216a5d27e601d6c104e24cf092a5f9..9dd9bb46d56006b99a978b7eb6c57941b705bf30 100644 (file)
@@ -116,6 +116,7 @@ nlopt_opt NLOPT_STDCALL nlopt_copy(const nlopt_opt opt)
      nlopt_opt nopt = NULL;
      unsigned i;
      if (opt) {
+         nlopt_munge munge;
          nopt = (nlopt_opt) malloc(sizeof(struct nlopt_opt_s));
          *nopt = *opt;
          nopt->lb = nopt->ub = nopt->xtol_abs = NULL;
@@ -126,7 +127,7 @@ nlopt_opt NLOPT_STDCALL nlopt_copy(const nlopt_opt opt)
          nopt->work = NULL;
          opt->force_stop_child = NULL;
 
-         nlopt_munge munge = nopt->munge_on_copy;
+         munge = nopt->munge_on_copy;
          if (munge && nopt->f_data)
               if (!(nopt->f_data = munge(nopt->f_data))) goto oom;