~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_getopt.c

  • Committer: Brian Aker
  • Date: 2008-07-18 20:10:26 UTC
  • mfrom: (51.3.29 remove-dbug)
  • Revision ID: brian@tangent.org-20080718201026-tto5golt0xhwqe4a
Merging in Jay's final patch on dbug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
  int error, i;
120
120
 
121
121
  /* handle_options() assumes arg0 (program name) always exists */
122
 
  DBUG_ASSERT(argc && *argc >= 1);
123
 
  DBUG_ASSERT(argv && *argv);
 
122
  assert(argc && *argc >= 1);
 
123
  assert(argv && *argv);
124
124
  (*argc)--; /* Skip the program name */
125
125
  (*argv)++; /*      --- || ----      */
126
126
  init_variables(longopts, init_one_value);
822
822
#endif
823
823
    break;
824
824
  default:
825
 
    DBUG_ASSERT((optp->var_type & GET_TYPE_MASK) == GET_LL);
 
825
    assert((optp->var_type & GET_TYPE_MASK) == GET_LL);
826
826
    break;
827
827
  }
828
828
 
890
890
#endif
891
891
    break;
892
892
  default:
893
 
    DBUG_ASSERT((optp->var_type & GET_TYPE_MASK) == GET_ULL);
 
893
    assert((optp->var_type & GET_TYPE_MASK) == GET_ULL);
894
894
    break;
895
895
  }
896
896
 
960
960
static void init_one_value(const struct my_option *option, char** variable,
961
961
                           int64_t value)
962
962
{
963
 
  DBUG_ENTER("init_one_value");
964
963
  switch ((option->var_type & GET_TYPE_MASK)) {
965
964
  case GET_BOOL:
966
965
    *((bool*) variable)= (bool) value;
1014
1013
  default: /* dummy default to avoid compiler warnings */
1015
1014
    break;
1016
1015
  }
1017
 
  DBUG_VOID_RETURN;
 
1016
  return;
1018
1017
}
1019
1018
 
1020
1019
 
1030
1029
static void fini_one_value(const struct my_option *option, char **variable,
1031
1030
                           int64_t value __attribute__ ((unused)))
1032
1031
{
1033
 
  DBUG_ENTER("fini_one_value");
1034
1032
  switch ((option->var_type & GET_TYPE_MASK)) {
1035
1033
  case GET_STR_ALLOC:
1036
1034
    my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR));
1039
1037
  default: /* dummy default to avoid compiler warnings */
1040
1038
    break;
1041
1039
  }
1042
 
  DBUG_VOID_RETURN;
 
1040
  return;
1043
1041
}
1044
1042
 
1045
1043
 
1065
1063
static void init_variables(const struct my_option *options,
1066
1064
                           init_func_p init_one_value)
1067
1065
{
1068
 
  DBUG_ENTER("init_variables");
1069
1066
  for (; options->name; options++)
1070
1067
  {
1071
1068
    char* *variable;
1072
 
    DBUG_PRINT("options", ("name: '%s'", options->name));
1073
1069
    /*
1074
1070
      We must set u_max_value first as for some variables
1075
1071
      options->u_max_value == options->value and in this case we want to
1083
1079
        (variable= (*getopt_get_addr)("", 0, options)))
1084
1080
      init_one_value(options, variable, options->def_value);
1085
1081
  }
1086
 
  DBUG_VOID_RETURN;
 
1082
  return;
1087
1083
}
1088
1084
 
1089
1085