MCPcopy Create free account
hub / github.com/OpenPrinting/cups / ppd_get_option

Function ppd_get_option

cups/ppd.c:2818–2852  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2816 */
2817
2818static ppd_option_t * /* O - Named option */
2819ppd_get_option(ppd_group_t *group, /* I - Group */
2820 const char *name) /* I - Name of option */
2821{
2822 int i; /* Looping var */
2823 ppd_option_t *option; /* Option */
2824
2825
2826 DEBUG_printf(("7ppd_get_option(group=%p(\"%s\"), name=\"%s\")",
2827 group, group->name, name));
2828
2829 for (i = group->num_options, option = group->options; i > 0; i --, option ++)
2830 if (!strcmp(option->keyword, name))
2831 break;
2832
2833 if (i == 0)
2834 {
2835 if (group->num_options == 0)
2836 option = malloc(sizeof(ppd_option_t));
2837 else
2838 option = realloc(group->options, (size_t)(group->num_options + 1) * sizeof(ppd_option_t));
2839
2840 if (option == NULL)
2841 return (NULL);
2842
2843 group->options = option;
2844 option += group->num_options;
2845 group->num_options ++;
2846
2847 memset(option, 0, sizeof(ppd_option_t));
2848 strlcpy(option->keyword, name, sizeof(option->keyword));
2849 }
2850
2851 return (option);
2852}
2853
2854
2855/*

Callers 1

_ppdOpenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected