mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-25 14:51:52 +02:00
eeshow/gfx/pdftoc.c: use strbegins instead of local "begins"
This commit is contained in:
parent
fe6d3a9e85
commit
417ddb16fa
@ -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 *pdftoc_begin(const char *file)
|
||||||
{
|
{
|
||||||
struct pdftoc *ctx;
|
struct pdftoc *ctx;
|
||||||
@ -149,27 +143,27 @@ static void line(struct pdftoc *ctx, const char *s)
|
|||||||
ctx->state = object;
|
ctx->state = object;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (begins(s, "xref")) {
|
if (strbegins(s, "xref")) {
|
||||||
ctx->state = xref;
|
ctx->state = xref;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case object:
|
case object:
|
||||||
if (begins(s, "endobj")) {
|
if (strbegins(s, "endobj")) {
|
||||||
ctx->state = idle;
|
ctx->state = idle;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (begins(s, "<< /Type /Page")) {
|
if (strbegins(s, "<< /Type /Page")) {
|
||||||
ctx->curr_obj->is_page = 1;
|
ctx->curr_obj->is_page = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (begins(s, "<< /Type /Catalog")) {
|
if (strbegins(s, "<< /Type /Catalog")) {
|
||||||
ctx->state = catalog;
|
ctx->state = catalog;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case catalog:
|
case catalog:
|
||||||
if (begins(s, ">>")) {
|
if (strbegins(s, ">>")) {
|
||||||
ctx->state = object;
|
ctx->state = object;
|
||||||
ctx->pos += fprintf(ctx->file,
|
ctx->pos += fprintf(ctx->file,
|
||||||
" /Outlines %u 0 R\n",
|
" /Outlines %u 0 R\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user