/*
- * "$Id: mark.c 5700 2006-06-26 19:20:39Z mike $"
+ * "$Id: mark.c 6036 2006-10-13 22:06:43Z mike $"
*
* Option marking routines for the Common UNIX Printing System (CUPS).
*
int /* O - Number of conflicts found */
ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
{
- int i, j, k, /* Looping variables */
+ int i, j, /* Looping variables */
conflicts; /* Number of conflicts */
ppd_const_t *c; /* Current constraint */
- ppd_group_t *g, *sg; /* Groups */
ppd_option_t *o1, *o2; /* Options */
ppd_choice_t *c1, *c2; /* Choices */
- if (ppd == NULL)
+ if (!ppd)
return (0);
/*
conflicts = 0;
- for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++)
- {
- for (j = g->num_options, o1 = g->options; j > 0; j --, o1 ++)
- o1->conflicted = 0;
-
- for (j = g->num_subgroups, sg = g->subgroups; j > 0; j --, sg ++)
- for (k = sg->num_options, o1 = sg->options; k > 0; k --, o1 ++)
- o1->conflicted = 0;
- }
+ for (o1 = ppdFirstOption(ppd); o1; o1 = ppdNextOption(ppd))
+ o1->conflicted = 0;
/*
* Loop through all of the UI constraints and flag any options
o1 = ppdFindOption(ppd, c->option1);
- if (o1 == NULL)
+ if (!o1)
continue;
- else if (c->choice1[0] != '\0')
+ else if (c->choice1[0])
{
/*
* This constraint maps to a specific choice.
if (c1->marked)
break;
- if (j == 0 ||
- strcasecmp(c1->choice, "None") == 0 ||
- strcasecmp(c1->choice, "Off") == 0 ||
- strcasecmp(c1->choice, "False") == 0)
+ if (!j ||
+ !strcasecmp(c1->choice, "None") ||
+ !strcasecmp(c1->choice, "Off") ||
+ !strcasecmp(c1->choice, "False"))
c1 = NULL;
}
o2 = ppdFindOption(ppd, c->option2);
- if (o2 == NULL)
+ if (!o2)
continue;
- else if (c->choice2[0] != '\0')
+ else if (c->choice2[0])
{
/*
* This constraint maps to a specific choice.
if (c2->marked)
break;
- if (j == 0 ||
- strcasecmp(c2->choice, "None") == 0 ||
- strcasecmp(c2->choice, "Off") == 0 ||
- strcasecmp(c2->choice, "False") == 0)
+ if (!j ||
+ !strcasecmp(c2->choice, "None") ||
+ !strcasecmp(c2->choice, "Off") ||
+ !strcasecmp(c2->choice, "False"))
c2 = NULL;
}
* If both options are marked then there is a conflict...
*/
- if (c1 != NULL && c1->marked &&
- c2 != NULL && c2->marked)
+ if (c1 && c1->marked && c2 && c2->marked)
{
DEBUG_printf(("%s->%s conflicts with %s->%s (%s %s %s %s)\n",
o1->keyword, c1->choice, o2->keyword, c2->choice,
/*
- * End of "$Id: mark.c 5700 2006-06-26 19:20:39Z mike $".
+ * End of "$Id: mark.c 6036 2006-10-13 22:06:43Z mike $".
*/