* Definitions...
*/
-#define ppd_free(p) if (p) free(p) /* Safe free macro */
-
#define PPD_KEYWORD 1 /* Line contained a keyword */
#define PPD_OPTION 2 /* Line contained an option name */
#define PPD_TEXT 4 /* Line contained human-readable text */
* Free all strings at the top level...
*/
- _cupsStrFree(ppd->lang_encoding);
- _cupsStrFree(ppd->nickname);
- if (ppd->patches)
- free(ppd->patches);
- _cupsStrFree(ppd->jcl_begin);
- _cupsStrFree(ppd->jcl_end);
- _cupsStrFree(ppd->jcl_ps);
+ free(ppd->lang_encoding);
+ free(ppd->nickname);
+ free(ppd->patches);
+ free(ppd->jcl_begin);
+ free(ppd->jcl_end);
+ free(ppd->jcl_ps);
/*
* Free any UI groups, subgroups, and options...
for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++)
ppd_free_group(group);
- ppd_free(ppd->groups);
+ free(ppd->groups);
}
cupsArrayDelete(ppd->options);
*/
if (ppd->num_sizes > 0)
- ppd_free(ppd->sizes);
+ free(ppd->sizes);
/*
* Free any constraints...
*/
if (ppd->num_consts > 0)
- ppd_free(ppd->consts);
+ free(ppd->consts);
/*
* Free any filters...
if (ppd->num_fonts > 0)
{
for (i = ppd->num_fonts, font = ppd->fonts; i > 0; i --, font ++)
- _cupsStrFree(*font);
+ free(*font);
- ppd_free(ppd->fonts);
+ free(ppd->fonts);
}
/*
*/
if (ppd->num_profiles > 0)
- ppd_free(ppd->profiles);
+ free(ppd->profiles);
/*
* Free any attributes...
{
for (i = ppd->num_attrs, attr = ppd->attrs; i > 0; i --, attr ++)
{
- _cupsStrFree((*attr)->value);
- ppd_free(*attr);
+ free((*attr)->value);
+ free(*attr);
}
- ppd_free(ppd->attrs);
+ free(ppd->attrs);
}
cupsArrayDelete(ppd->sorted_attrs);
case PPD_CUSTOM_PASSCODE :
case PPD_CUSTOM_PASSWORD :
case PPD_CUSTOM_STRING :
- _cupsStrFree(cparam->current.custom_string);
+ free(cparam->current.custom_string);
break;
default :
* Free the whole record...
*/
- ppd_free(ppd);
+ free(ppd);
}
if (pg->ppd_status == PPD_OK)
pg->ppd_status = PPD_MISSING_PPDADOBE4;
- _cupsStrFree(string);
- ppd_free(line.buffer);
+ free(string);
+ free(line.buffer);
return (NULL);
}
DEBUG_printf(("2_ppdOpen: keyword=%s, string=%p", keyword, string));
- _cupsStrFree(string);
+ free(string);
/*
* Allocate memory for the PPD file record...
{
pg->ppd_status = PPD_ALLOC_ERROR;
- _cupsStrFree(string);
- ppd_free(line.buffer);
+ free(string);
+ free(line.buffer);
return (NULL);
}
* Say all PPD files are UTF-8, since we convert to UTF-8...
*/
- ppd->lang_encoding = _cupsStrAlloc("UTF-8");
+ ppd->lang_encoding = strdup("UTF-8");
encoding = _ppdGetEncoding(string);
}
else if (!strcmp(keyword, "LanguageVersion"))
cupsCharsetToUTF8(utf8, string, sizeof(utf8), encoding);
- ppd->nickname = _cupsStrAlloc((char *)utf8);
+ ppd->nickname = strdup((char *)utf8);
}
else
- ppd->nickname = _cupsStrAlloc(string);
+ ppd->nickname = strdup(string);
}
else if (!strcmp(keyword, "Product"))
ppd->product = string;
ppd->ttrasterizer = string;
else if (!strcmp(keyword, "JCLBegin"))
{
- ppd->jcl_begin = _cupsStrAlloc(string);
+ ppd->jcl_begin = strdup(string);
ppd_decode(ppd->jcl_begin); /* Decode quoted string */
}
else if (!strcmp(keyword, "JCLEnd"))
{
- ppd->jcl_end = _cupsStrAlloc(string);
+ ppd->jcl_end = strdup(string);
ppd_decode(ppd->jcl_end); /* Decode quoted string */
}
else if (!strcmp(keyword, "JCLToPSInterpreter"))
{
- ppd->jcl_ps = _cupsStrAlloc(string);
+ ppd->jcl_ps = strdup(string);
ppd_decode(ppd->jcl_ps); /* Decode quoted string */
}
else if (!strcmp(keyword, "AccurateScreensSupport"))
ppd->num_filters ++;
/*
- * Retain a copy of the filter string...
+ * Make a copy of the filter string...
*/
- *filter = _cupsStrRetain(string);
+ *filter = strdup(string);
}
else if (!strcmp(keyword, "Throughput"))
ppd->throughput = atoi(string);
}
ppd->fonts = tempfonts;
- ppd->fonts[ppd->num_fonts] = _cupsStrAlloc(name);
+ ppd->fonts[ppd->num_fonts] = strdup(name);
ppd->num_fonts ++;
}
else if (!strncmp(keyword, "ParamCustom", 11))
strlcpy(choice->text, text[0] ? text : _("Custom"),
sizeof(choice->text));
- choice->code = _cupsStrAlloc(string);
+ choice->code = strdup(string);
if (custom_option->section == PPD_ORDER_JCL)
ppd_decode(choice->code);
option->section = PPD_ORDER_ANY;
- _cupsStrFree(string);
+ free(string);
string = NULL;
/*
strlcpy(choice->text,
custom_attr->text[0] ? custom_attr->text : _("Custom"),
sizeof(choice->text));
- choice->code = _cupsStrRetain(custom_attr->value);
+ choice->code = strdup(custom_attr->value);
}
}
else if (!strcmp(keyword, "JCLOpenUI"))
option->section = PPD_ORDER_JCL;
group = NULL;
- _cupsStrFree(string);
+ free(string);
string = NULL;
/*
strlcpy(choice->text,
custom_attr->text[0] ? custom_attr->text : _("Custom"),
sizeof(choice->text));
- choice->code = _cupsStrRetain(custom_attr->value);
+ choice->code = strdup(custom_attr->value);
}
}
else if (!strcmp(keyword, "CloseUI"))
option = NULL;
- _cupsStrFree(string);
+ free(string);
string = NULL;
}
else if (!strcmp(keyword, "JCLCloseUI"))
option = NULL;
- _cupsStrFree(string);
+ free(string);
string = NULL;
}
else if (!strcmp(keyword, "OpenGroup"))
if (group == NULL)
goto error;
- _cupsStrFree(string);
+ free(string);
string = NULL;
}
else if (!strcmp(keyword, "CloseGroup"))
{
group = NULL;
- _cupsStrFree(string);
+ free(string);
string = NULL;
}
else if (!strcmp(keyword, "OrderDependency"))
option->order = order;
}
- _cupsStrFree(string);
+ free(string);
string = NULL;
}
else if (!strncmp(keyword, "Default", 7))
* Don't add this one as an attribute...
*/
- _cupsStrFree(string);
+ free(string);
string = NULL;
}
else if (!strcmp(keyword, "PaperDimension"))
size->width = (float)_cupsStrScand(string, &sptr, loc);
size->length = (float)_cupsStrScand(sptr, NULL, loc);
- _cupsStrFree(string);
+ free(string);
string = NULL;
}
else if (!strcmp(keyword, "ImageableArea"))
size->right = (float)_cupsStrScand(sptr, &sptr, loc);
size->top = (float)_cupsStrScand(sptr, NULL, loc);
- _cupsStrFree(string);
+ free(string);
string = NULL;
}
else if (option != NULL &&
(mask & (PPD_KEYWORD | PPD_STRING)) == (PPD_KEYWORD | PPD_STRING))
ppd_add_attr(ppd, keyword, name, text, string);
else
- _cupsStrFree(string);
+ free(string);
}
/*
goto error;
}
- ppd_free(line.buffer);
+ free(line.buffer);
/*
* Reset language preferences...
error:
- _cupsStrFree(string);
- ppd_free(line.buffer);
+ free(string);
+ free(line.buffer);
ppdClose(ppd);
if (ppd->num_filters > 0)
{
for (i = ppd->num_filters, filter = ppd->filters; i > 0; i --, filter ++)
- _cupsStrFree(*filter);
+ free(*filter);
- ppd_free(ppd->filters);
+ free(ppd->filters);
ppd->num_filters = 0;
ppd->filters = NULL;
i --, option ++)
ppd_free_option(option);
- ppd_free(group->options);
+ free(group->options);
}
if (group->num_subgroups > 0)
i --, subgroup ++)
ppd_free_group(subgroup);
- ppd_free(group->subgroups);
+ free(group->subgroups);
}
}
i > 0;
i --, choice ++)
{
- _cupsStrFree(choice->code);
+ free(choice->code);
}
- ppd_free(option->choices);
+ free(option->choices);
}
}
lineptr ++;
}
- *string = _cupsStrAlloc(lineptr);
+ *string = strdup(lineptr);
mask |= PPD_STRING;
}
filter += ppd->num_filters;
ppd->num_filters ++;
- *filter = _cupsStrAlloc(buffer);
+ *filter = strdup(buffer);
}
while ((attr = ppdFindNextAttr(ppd, "cupsFilter2", NULL)) != NULL);