~gearman-developers/pkg-gearman/trunk

« back to all changes in this revision

Viewing changes to libgearman-server/conf.c

  • Committer: Monty Taylor
  • Date: 2010-05-13 12:23:50 UTC
  • mfrom: (330.2.8 gearmand)
  • Revision ID: mordred@inaugust.com-20100513122350-s7o5ez3vewqrjmhn
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    if (conf == NULL)
26
26
      return NULL;
27
27
 
28
 
    conf->options= GEARMAN_CONF_ALLOCATED;
 
28
    conf->options.allocated= true;
29
29
  }
30
30
  else
31
 
    conf->options= 0;
 
31
  {
 
32
    conf->options.allocated= false;
 
33
  }
32
34
 
33
35
  conf->last_return= GEARMAN_SUCCESS;
34
36
  conf->last_errno= 0;
77
79
  if (conf->option_getopt != NULL)
78
80
    free(conf->option_getopt);
79
81
 
80
 
  if (conf->options & GEARMAN_CONF_ALLOCATED)
 
82
  if (conf->options.allocated)
81
83
    free(conf);
82
84
}
83
85
 
96
98
  return conf->last_errno;
97
99
}
98
100
 
99
 
void gearman_conf_set_options(gearman_conf_st *conf,
100
 
                              gearman_conf_options_t options, uint32_t data)
101
 
{
102
 
  if (data)
103
 
    conf->options |= options;
104
 
  else
105
 
    conf->options &= ~options;
106
 
}
107
 
 
108
101
gearman_return_t gearman_conf_parse_args(gearman_conf_st *conf, int argc,
109
102
                                         char *argv[])
110
103
{
139
132
 
140
133
      if (opt_index == (int)conf->option_count)
141
134
      {
142
 
        GEARMAN_CONF_ERROR_SET(conf, "ERROR", " Unknown option: %s",
143
 
                               argv[optind - 1]);
 
135
        gearman_conf_error_set(conf, "ERROR", " Unknown option: %s", argv[optind - 1]);
144
136
        return GEARMAN_UNKNOWN_OPTION;
145
137
      }
146
138
    }
150
142
                        sizeof(char *) * (option->value_count + 1));
151
143
    if (value_list == NULL)
152
144
    {
153
 
      GEARMAN_CONF_ERROR_SET(conf, "gearman_conf_parse_args", "realloc");
 
145
      gearman_conf_error_set(conf, "gearman_conf_parse_args", " realloc");
154
146
      return GEARMAN_MEMORY_ALLOCATION_FAILURE;
155
147
    }
156
148
 
161
153
 
162
154
  if (optind < argc)
163
155
  {
164
 
    GEARMAN_CONF_ERROR_SET(conf, "gearman_conf_parse_args",
165
 
                           "Unknown option: %s", argv[optind]);
 
156
    gearman_conf_error_set(conf, "gearman_conf_parse_args", "Unknown option: %s", argv[optind]);
166
157
    return GEARMAN_UNKNOWN_OPTION;
167
158
  }
168
159
 
209
200
    if (max_length > GEARMAN_CONF_DISPLAY_WIDTH - 2)
210
201
      max_length= GEARMAN_CONF_DISPLAY_WIDTH - 2;
211
202
 
212
 
    /* Print out all options for this module. */
 
203
    /* Print out all options.allocated for this module. */
213
204
    for (y= 0; y < conf->option_count; y++)
214
205
    {
215
206
      option= &conf->option_list[y];