Pass argc pointer to parse_options()
This lets us keep argc up to date as the backend picks out arguments from the argv array.
This commit is contained in:
@@ -2134,7 +2134,7 @@ planes_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data)
|
||||
static struct weston_compositor *
|
||||
drm_compositor_create(struct wl_display *display,
|
||||
int connector, const char *seat, int tty, int pixman,
|
||||
int argc, char *argv[], const char *config_file)
|
||||
int *argc, char *argv[], const char *config_file)
|
||||
{
|
||||
struct drm_compositor *ec;
|
||||
struct udev_device *drm_device;
|
||||
@@ -2430,7 +2430,7 @@ output_section_done(void *data)
|
||||
}
|
||||
|
||||
WL_EXPORT struct weston_compositor *
|
||||
backend_init(struct wl_display *display, int argc, char *argv[],
|
||||
backend_init(struct wl_display *display, int *argc, char *argv[],
|
||||
const char *config_file)
|
||||
{
|
||||
int connector = 0, tty = 0, use_pixman = 0;
|
||||
|
||||
@@ -826,7 +826,7 @@ switch_vt_binding(struct wl_seat *seat, uint32_t time, uint32_t key, void *data)
|
||||
}
|
||||
|
||||
static struct weston_compositor *
|
||||
fbdev_compositor_create(struct wl_display *display, int argc, char *argv[],
|
||||
fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[],
|
||||
const char *config_file, struct fbdev_parameters *param)
|
||||
{
|
||||
struct fbdev_compositor *compositor;
|
||||
@@ -897,7 +897,7 @@ out_free:
|
||||
}
|
||||
|
||||
WL_EXPORT struct weston_compositor *
|
||||
backend_init(struct wl_display *display, int argc, char *argv[],
|
||||
backend_init(struct wl_display *display, int *argc, char *argv[],
|
||||
const char *config_file)
|
||||
{
|
||||
/* TODO: Ideally, available frame buffers should be enumerated using
|
||||
|
||||
@@ -152,7 +152,7 @@ headless_destroy(struct weston_compositor *ec)
|
||||
static struct weston_compositor *
|
||||
headless_compositor_create(struct wl_display *display,
|
||||
int width, int height, const char *display_name,
|
||||
int argc, char *argv[], const char *config_file)
|
||||
int *argc, char *argv[], const char *config_file)
|
||||
{
|
||||
struct headless_compositor *c;
|
||||
|
||||
@@ -187,7 +187,7 @@ err_free:
|
||||
}
|
||||
|
||||
WL_EXPORT struct weston_compositor *
|
||||
backend_init(struct wl_display *display, int argc, char *argv[],
|
||||
backend_init(struct wl_display *display, int *argc, char *argv[],
|
||||
const char *config_file)
|
||||
{
|
||||
int width = 1024, height = 640;
|
||||
|
||||
@@ -1423,7 +1423,7 @@ struct rpi_parameters {
|
||||
};
|
||||
|
||||
static struct weston_compositor *
|
||||
rpi_compositor_create(struct wl_display *display, int argc, char *argv[],
|
||||
rpi_compositor_create(struct wl_display *display, int *argc, char *argv[],
|
||||
const char *config_file, struct rpi_parameters *param)
|
||||
{
|
||||
struct rpi_compositor *compositor;
|
||||
@@ -1536,7 +1536,7 @@ out_free:
|
||||
#define DEFAULT_MAX_PLANES 80
|
||||
|
||||
WL_EXPORT struct weston_compositor *
|
||||
backend_init(struct wl_display *display, int argc, char *argv[],
|
||||
backend_init(struct wl_display *display, int *argc, char *argv[],
|
||||
const char *config_file)
|
||||
{
|
||||
struct rpi_parameters param = {
|
||||
|
||||
@@ -622,7 +622,7 @@ wayland_destroy(struct weston_compositor *ec)
|
||||
static struct weston_compositor *
|
||||
wayland_compositor_create(struct wl_display *display,
|
||||
int width, int height, const char *display_name,
|
||||
int argc, char *argv[], const char *config_file)
|
||||
int *argc, char *argv[], const char *config_file)
|
||||
{
|
||||
struct wayland_compositor *c;
|
||||
struct wl_event_loop *loop;
|
||||
@@ -697,7 +697,7 @@ err_free:
|
||||
}
|
||||
|
||||
WL_EXPORT struct weston_compositor *
|
||||
backend_init(struct wl_display *display, int argc, char *argv[],
|
||||
backend_init(struct wl_display *display, int *argc, char *argv[],
|
||||
const char *config_file)
|
||||
{
|
||||
int width = 1024, height = 640;
|
||||
|
||||
@@ -1366,7 +1366,7 @@ x11_compositor_create(struct wl_display *display,
|
||||
int fullscreen,
|
||||
int no_input,
|
||||
int use_pixman,
|
||||
int argc, char *argv[], const char *config_file)
|
||||
int *argc, char *argv[], const char *config_file)
|
||||
{
|
||||
struct x11_compositor *c;
|
||||
struct x11_configured_output *o;
|
||||
@@ -1556,7 +1556,7 @@ err_free:
|
||||
}
|
||||
|
||||
WL_EXPORT struct weston_compositor *
|
||||
backend_init(struct wl_display *display, int argc, char *argv[],
|
||||
backend_init(struct wl_display *display, int *argc, char *argv[],
|
||||
const char *config_file)
|
||||
{
|
||||
int fullscreen = 0;
|
||||
|
||||
+7
-8
@@ -2951,8 +2951,7 @@ log_uname(void)
|
||||
WL_EXPORT int
|
||||
weston_compositor_init(struct weston_compositor *ec,
|
||||
struct wl_display *display,
|
||||
int argc,
|
||||
char *argv[],
|
||||
int *argc, char *argv[],
|
||||
const char *config_file)
|
||||
{
|
||||
struct wl_event_loop *loop;
|
||||
@@ -3336,7 +3335,7 @@ int main(int argc, char *argv[])
|
||||
struct sigaction segv_action;
|
||||
struct weston_compositor
|
||||
*(*backend_init)(struct wl_display *display,
|
||||
int argc, char *argv[], const char *config_file);
|
||||
int *argc, char *argv[], const char *config_file);
|
||||
int i;
|
||||
char *backend = NULL;
|
||||
const char *modules = "desktop-shell.so", *option_modules = NULL;
|
||||
@@ -3366,8 +3365,7 @@ int main(int argc, char *argv[])
|
||||
{ WESTON_OPTION_BOOLEAN, "version", 0, &version },
|
||||
};
|
||||
|
||||
argc = parse_options(core_options,
|
||||
ARRAY_LENGTH(core_options), argc, argv);
|
||||
parse_options(core_options, ARRAY_LENGTH(core_options), &argc, argv);
|
||||
|
||||
if (help)
|
||||
usage(EXIT_SUCCESS);
|
||||
@@ -3419,7 +3417,7 @@ int main(int argc, char *argv[])
|
||||
if (!backend_init)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
ec = backend_init(display, argc, argv, config_file);
|
||||
ec = backend_init(display, &argc, argv, config_file);
|
||||
if (ec == NULL) {
|
||||
weston_log("fatal: failed to create compositor\n");
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -3431,9 +3429,10 @@ int main(int argc, char *argv[])
|
||||
sigaction(SIGSEGV, &segv_action, NULL);
|
||||
segv_compositor = ec;
|
||||
|
||||
for (i = 1; argv[i]; i++)
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
weston_log("fatal: unhandled option: %s\n", argv[i]);
|
||||
if (argv[1]) {
|
||||
if (argc > 1) {
|
||||
ret = EXIT_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
+3
-3
@@ -714,7 +714,7 @@ weston_compositor_get_time(void);
|
||||
|
||||
int
|
||||
weston_compositor_init(struct weston_compositor *ec, struct wl_display *display,
|
||||
int argc, char *argv[], const char *config_file);
|
||||
int *argc, char *argv[], const char *config_file);
|
||||
void
|
||||
weston_compositor_shutdown(struct weston_compositor *ec);
|
||||
void
|
||||
@@ -839,8 +839,8 @@ int
|
||||
noop_renderer_init(struct weston_compositor *ec);
|
||||
|
||||
struct weston_compositor *
|
||||
backend_init(struct wl_display *display, int argc, char *argv[],
|
||||
const char *config_file);
|
||||
backend_init(struct wl_display *display, int *argc, char *argv[],
|
||||
const char *config_file);
|
||||
|
||||
int
|
||||
module_init(struct weston_compositor *compositor);
|
||||
|
||||
Reference in New Issue
Block a user