mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-23 05:05:20 +02:00
eeshow/cro.c (new_cc): separate context creation from option parsing
This commit is contained in:
parent
52ab16d62a
commit
a564b5d03e
21
eeshow/cro.c
21
eeshow/cro.c
@ -255,10 +255,9 @@ static const struct gfx_ops real_cro_ops = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static struct cro_ctx *init_common(int argc, char *const *argv)
|
static struct cro_ctx *new_cc(void)
|
||||||
{
|
{
|
||||||
struct cro_ctx *cc;
|
struct cro_ctx *cc;
|
||||||
char c;
|
|
||||||
|
|
||||||
cc = alloc_type(struct cro_ctx);
|
cc = alloc_type(struct cro_ctx);
|
||||||
cc->xo = cc->yo = 0;
|
cc->xo = cc->yo = 0;
|
||||||
@ -270,6 +269,22 @@ static struct cro_ctx *init_common(int argc, char *const *argv)
|
|||||||
cc->color_override = COLOR_NONE;
|
cc->color_override = COLOR_NONE;
|
||||||
|
|
||||||
cc->output_name = NULL;
|
cc->output_name = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* record_init does not perform allocations or such, so it's safe to
|
||||||
|
* call it here even if we don't use this facility.
|
||||||
|
*/
|
||||||
|
record_init(&cc->record, &real_cro_ops, cc);
|
||||||
|
|
||||||
|
return cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct cro_ctx *init_common(int argc, char *const *argv)
|
||||||
|
{
|
||||||
|
struct cro_ctx *cc = new_cc();
|
||||||
|
char c;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "o:s:")) != EOF)
|
while ((c = getopt(argc, argv, "o:s:")) != EOF)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'o':
|
case 'o':
|
||||||
@ -282,8 +297,6 @@ static struct cro_ctx *init_common(int argc, char *const *argv)
|
|||||||
usage(*argv);
|
usage(*argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
record_init(&cc->record, &real_cro_ops, cc);
|
|
||||||
|
|
||||||
return cc;
|
return cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user