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

Function ppdCollect2

cups/ppd-emit.c:72–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70 */
71
72int /* O - Number of options marked */
73ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */
74 ppd_section_t section, /* I - Section to collect */
75 float min_order, /* I - Minimum OrderDependency value */
76 ppd_choice_t ***choices) /* O - Pointers to choices */
77{
78 ppd_choice_t *c; /* Current choice */
79 ppd_section_t csection; /* Current section */
80 float corder; /* Current OrderDependency value */
81 int count; /* Number of choices collected */
82 ppd_choice_t **collect; /* Collected choices */
83 float *orders; /* Collected order values */
84
85
86 DEBUG_printf(("ppdCollect2(ppd=%p, section=%d, min_order=%f, choices=%p)",
87 ppd, section, min_order, choices));
88
89 if (!ppd || !choices)
90 {
91 if (choices)
92 *choices = NULL;
93
94 return (0);
95 }
96
97 /*
98 * Allocate memory for up to N selected choices...
99 */
100
101 count = 0;
102 if ((collect = calloc((size_t)cupsArrayCount(ppd->marked),
103 sizeof(ppd_choice_t *))) == NULL)
104 {
105 *choices = NULL;
106 return (0);
107 }
108
109 if ((orders = calloc((size_t)cupsArrayCount(ppd->marked), sizeof(float))) == NULL)
110 {
111 *choices = NULL;
112 free(collect);
113 return (0);
114 }
115
116 /*
117 * Loop through all options and add choices as needed...
118 */
119
120 for (c = (ppd_choice_t *)cupsArrayFirst(ppd->marked);
121 c;
122 c = (ppd_choice_t *)cupsArrayNext(ppd->marked))
123 {
124 csection = c->option->section;
125 corder = c->option->order;
126
127 if (!strcmp(c->choice, "Custom"))
128 {
129 ppd_attr_t *attr; /* NonUIOrderDependency value */

Callers 2

ppdCollectFunction · 0.85
ppdEmitStringFunction · 0.85

Calls 5

cupsArrayCountFunction · 0.85
cupsArrayFirstFunction · 0.85
cupsArrayNextFunction · 0.85
ppdFindAttrFunction · 0.85
ppdFindNextAttrFunction · 0.85

Tested by

no test coverage detected