[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Wed, 9 Jan 2013 08:07:17 -0800
On Wed, Jan 09, 2013 at 11:23:30AM +0100, John Darrington wrote:
> In src/output/options.c we have:
> /* Creates and returns a new struct driver_option for output driver DRIVER
> (which is needed only to the extent that its name will be used in error
> messages). The option named NAME is extracted from OPTIONS. DEFAULT_VALUE
> is the default value of the option, used if the given option was not
> supplied or was invalid. */
> Why does it use string_map_find_and_delete ? Why not simply string_map_find?
> Why does it need to delete the item from the string map?
The output drivers delete the options that they process from the string
map so that output_driver_create() can report any options that the
output drivers didn't process:
driver = f->create (file_name, device_type, options);
if (driver != NULL)
const struct string_map_node *node;
const char *key;
STRING_MAP_FOR_EACH_KEY (key, node, options)
error (0, 0, _("%s: unknown option `%s'"), file_name, key);
Other methods are possible but this one is very simple.
- options.c, John Darrington, 2013/01/09
- Re: options.c,
Ben Pfaff <=