1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-05 03:47:10 +02:00

eeshow/gfx/pdftoc.c: use strbegins instead of local "begins"

This commit is contained in:
Werner Almesberger 2016-08-22 21:25:44 -03:00
parent fe6d3a9e85
commit 417ddb16fa

View File

@ -69,12 +69,6 @@ struct pdftoc {
};
static bool begins(const char *s, const char *pfx)
{
return !strncmp(s, pfx, strlen(pfx));
}
struct pdftoc *pdftoc_begin(const char *file)
{
struct pdftoc *ctx;
@ -149,27 +143,27 @@ static void line(struct pdftoc *ctx, const char *s)
ctx->state = object;
break;
}
if (begins(s, "xref")) {
if (strbegins(s, "xref")) {
ctx->state = xref;
break;
}
break;
case object:
if (begins(s, "endobj")) {
if (strbegins(s, "endobj")) {
ctx->state = idle;
break;
}
if (begins(s, "<< /Type /Page")) {
if (strbegins(s, "<< /Type /Page")) {
ctx->curr_obj->is_page = 1;
break;
}
if (begins(s, "<< /Type /Catalog")) {
if (strbegins(s, "<< /Type /Catalog")) {
ctx->state = catalog;
break;
}
break;
case catalog:
if (begins(s, ">>")) {
if (strbegins(s, ">>")) {
ctx->state = object;
ctx->pos += fprintf(ctx->file,
" /Outlines %u 0 R\n",