Pass argc pointer to parse_options()

This lets us keep argc up to date as the backend picks out arguments
from the argv array.
dev
Kristian Høgsberg 12 years ago
parent d5a97ae053
commit 4172f668e7
  1. 2
      clients/calibrator.c
  2. 2
      clients/clickdot.c
  3. 2
      clients/cliptest.c
  4. 2
      clients/desktop-shell.c
  5. 2
      clients/dnd.c
  6. 2
      clients/editor.c
  7. 6
      clients/eventdemo.c
  8. 2
      clients/flower.c
  9. 2
      clients/gears.c
  10. 2
      clients/image.c
  11. 2
      clients/keyboard.c
  12. 2
      clients/resizor.c
  13. 2
      clients/smoke.c
  14. 2
      clients/tablet-shell.c
  15. 6
      clients/terminal.c
  16. 2
      clients/transformed.c
  17. 5
      clients/view.c
  18. 2
      clients/window.c
  19. 2
      clients/window.h
  20. 6
      clients/wscreensaver.c
  21. 2
      shared/config-parser.h
  22. 5
      shared/option-parser.c
  23. 4
      src/compositor-drm.c
  24. 4
      src/compositor-fbdev.c
  25. 4
      src/compositor-headless.c
  26. 4
      src/compositor-rpi.c
  27. 4
      src/compositor-wayland.c
  28. 4
      src/compositor-x11.c
  29. 15
      src/compositor.c
  30. 6
      src/compositor.h

@ -238,7 +238,7 @@ main(int argc, char *argv[])
struct display *display;
struct calibrator *calibrator;
display = display_create(argc, argv);
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");

@ -297,7 +297,7 @@ main(int argc, char *argv[])
struct display *display;
struct clickdot *clickdot;
display = display_create(argc, argv);
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -890,7 +890,7 @@ main(int argc, char *argv[])
if (argc > 1)
return benchmark();
d = display_create(argc, argv);
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -1094,7 +1094,7 @@ int main(int argc, char *argv[])
desktop.unlock_task.run = unlock_dialog_finish;
wl_list_init(&desktop.outputs);
desktop.display = display_create(argc, argv);
desktop.display = display_create(&argc, argv);
if (desktop.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -614,7 +614,7 @@ main(int argc, char *argv[])
struct dnd *dnd;
int i;
d = display_create(argc, argv);
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -1056,7 +1056,7 @@ main(int argc, char *argv[])
g_type_init();
#endif
editor.display = display_create(argc, argv);
editor.display = display_create(&argc, argv);
if (editor.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -390,11 +390,11 @@ main(int argc, char *argv[])
struct display *d;
struct eventdemo *e;
argc = parse_options(eventdemo_options,
ARRAY_LENGTH(eventdemo_options), argc, argv);
parse_options(eventdemo_options,
ARRAY_LENGTH(eventdemo_options), &argc, argv);
/* Connect to the display and have the arguments parsed */
d = display_create(argc, argv);
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -159,7 +159,7 @@ int main(int argc, char *argv[])
struct display *d;
struct timeval tv;
d = display_create(argc, argv);
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -474,7 +474,7 @@ int main(int argc, char *argv[])
{
struct display *d;
d = display_create(argc, argv);
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -410,7 +410,7 @@ main(int argc, char *argv[])
int i;
int image_counter = 0;
d = display_create(argc, argv);
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -706,7 +706,7 @@ main(int argc, char *argv[])
memset(&virtual_keyboard, 0, sizeof virtual_keyboard);
virtual_keyboard.display = display_create(argc, argv);
virtual_keyboard.display = display_create(&argc, argv);
if (virtual_keyboard.display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -281,7 +281,7 @@ main(int argc, char *argv[])
struct display *display;
struct resizor *resizor;
display = display_create(argc, argv);
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -279,7 +279,7 @@ int main(int argc, char *argv[])
struct display *d;
int size;
d = display_create(argc, argv);
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -459,7 +459,7 @@ int main(int argc, char *argv[])
char *config_file;
struct output *output;
display = display_create(argc, argv);
display = display_create(&argc, argv);
if (display == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -2683,10 +2683,10 @@ int main(int argc, char *argv[])
NULL);
free(config_file);
argc = parse_options(terminal_options,
ARRAY_LENGTH(terminal_options), argc, argv);
parse_options(terminal_options,
ARRAY_LENGTH(terminal_options), &argc, argv);
d = display_create(argc, argv);
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -264,7 +264,7 @@ int main(int argc, char *argv[])
usage(EXIT_FAILURE);
}
d = display_create(argc, argv);
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -295,10 +295,9 @@ main(int argc, char *argv[])
g_type_init();
argc = parse_options(view_options,
ARRAY_LENGTH(view_options), argc, argv);
parse_options(view_options, ARRAY_LENGTH(view_options), &argc, argv);
d = display_create(argc, argv);
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return -1;

@ -4329,7 +4329,7 @@ handle_display_data(struct task *task, uint32_t events)
}
struct display *
display_create(int argc, char *argv[])
display_create(int *argc, char *argv[])
{
struct display *d;

@ -53,7 +53,7 @@ struct rectangle {
};
struct display *
display_create(int argc, char *argv[]);
display_create(int *argc, char *argv[]);
void
display_destroy(struct display *display);

@ -310,10 +310,10 @@ int main(int argc, char *argv[])
init_frand();
argc = parse_options(wscreensaver_options,
ARRAY_LENGTH(wscreensaver_options), argc, argv);
parse_options(wscreensaver_options,
ARRAY_LENGTH(wscreensaver_options), &argc, argv);
d = display_create(argc, argv);
d = display_create(&argc, argv);
if (d == NULL) {
fprintf(stderr, "failed to create display: %m\n");
return EXIT_FAILURE;

@ -67,7 +67,7 @@ struct weston_option {
int
parse_options(const struct weston_option *options,
int count, int argc, char *argv[]);
int count, int *argc, char *argv[]);
#endif /* CONFIGPARSER_H */

@ -51,11 +51,11 @@ handle_option(const struct weston_option *option, char *value)
int
parse_options(const struct weston_option *options,
int count, int argc, char *argv[])
int count, int *argc, char *argv[])
{
int i, j, k, len = 0;
for (i = 1, j = 1; i < argc; i++) {
for (i = 1, j = 1; i < *argc; i++) {
for (k = 0; k < count; k++) {
if (options[k].name)
len = strlen(options[k].name);
@ -77,6 +77,7 @@ parse_options(const struct weston_option *options,
argv[j++] = argv[i];
}
argv[j] = NULL;
*argc = j;
return j;
}

@ -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;

@ -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;
}

@ -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);

Loading…
Cancel
Save